[Papervision3D] [How To] Using AS3 on a Linux platform.
Evan Metheny
evanpmeth at gmail.com
Mon Feb 12 17:39:33 EST 2007
Posted this on
http://forum.papervision3d.org/Resources/CommunityForums/tabid/60/forumid/5/scope/threads/Default.aspx
Just thought it would get more use here.
There are Four different ways i found how to compile mxmlc(as3) on a Linux
platform:
1.) Eclipse flex2ant and Flex 2 SDK:
Using eclipse and the flex2ant plugin is my preferred method, because i use
eclipse for many other programing languages as well.
1 - Download the free flex sdk from
http://www.adobe.com/products/flex/
I found installing this was not straight forward in the
installation files. The easiest way to do it is to Unzip the SDK into a
permanent directory point to where your java plugin is in this file
flex/bin/jvm.config (eg "
java.home=/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/jre/lib/i386/libjava.so")
Thats all you have to do to install it.
2 - Follow the directions on this page for installing the flex2ant
plugin: http://www.flex2ant.org/
3- Create a generic project in eclipse
File>New>Project..>General>Project, Then create folders named bin and src.
4 -Make your build.xml file (example on the flex2ant page) and put
it in the base directory, Here is mine for the focus example:
<project name="flex" basedir="/home/evan/workspace/flex"
default="compile">
<property name="src.dir" value="${basedir}/src" />
<property name="bin.dir" value="${basedir}/bin" />
<target name="compile" description="compiles the tasks">
<mxmlc
compiler="${mxmlc}"
mainclass="${src.dir}/main.as"
as3="true"
strict="true"
output="${bin.dir}/focus.swf"
benchmark="false"
/>
</target>
</project>
As you can notice above the basedir is the path to the projects home folder.
As for the above build file, in order to get it to work with the eclipse
example on the svn host. Copy the paper vision src (org and com directories)
to your src directory in your project. then get this zip file (
http://evamet1.coconia.net/focus.zip ) and put the three files main.as,
FocusBody.png, Wheel.png into the src directory. After that copy the
Focus.dae ( in the same zip ) file to the bin directory because that is
where the ouputed .SWF will end up. Then follow below:
5 - Turn off the error reporting because the plug in does not
support live debugging :(. oh Well.
6- To build a project all you have to do is save the main.as that
is in the src directory file. Make sure the project is selected in the left
frame. Then press:
Shift+Alt+x
then press
Q
and you should get any error reporting in the console at the bottom.
-To run the project just go to the bin folder in the project and
double click on the swf file created (focus.swf).
-Thats it
2.) Comand-line and Shell Script w/ Flex 2 SDK:
The second way of compiling mxmlc source is to follow the first step above
for the Flex SDK installation and write a shell script to compile your
project. First make mxmlc to be able to run anywhere. Create a script called
mxmlc and put this in it EXCEPT put your home flex directory where the zip
was extracted:
#!/bin/sh
FLEX="/home/evan/downloads/flex" # Replace with yours
VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false"
java $VMARGS -jar "$FLEX/lib/mxmlc.jar" +flexlib="$FLEX/frameworks" $*
Then save it. After that, add it to your user binaries with this
comand: sudo ln -s /
path/to/new/file/mxmlc /usr/bin/mxmlc
Now mxmlc is available anywhere. From there you can compile a project like
so:
:~$ mxmlc /path/to/main.as
This will output a file that is named main.swf
to change the output refer to :
http://livedocs.macromedia.com/flex/2/docs/Part7_Build_Deploy.html
Then you can create a file to do this for you by just double clicking on it
and it will compile and open in FireFox to be viewed.. Make a file
called compile_main
and put this in it:
#!/bin/sh
mxmlc /home/evan/workspace/flex/src/main.as
exec firefox /home/evan/workspace/flex/src/main.swf
Save and quit. Then run these commands in terminal:
:~$ sudo chmod 0755 compile_main
:~$ sudo chmod a+X compile_main
Now you can just double click on the file and it outputs an swf and opens
it.
3)Flash 9 Pro Alpha and Wine:
Another way is to get Flash 9 Pro Alpha to work through wine, the only
configuration that needs to be done is to type in winecfg in the terminal
and change default settings to windows XP from there all you do is run the
install file through wine (eg :~$ wine FL9_AS3_Labs_06-27.exe ) and
everything shall work. I am using wine-0.9.28 and ubuntu edgy.
4)Using Flex Builder 2 on VMWare:
This is the non recommended way unless you have sufficient memory. Install
the latest version of VMWare and install windows 2000 pro. Why 2000, its
because it uses a great deal less memory and space then XP and Vista, plus
its exactly the same as XP without the fancy look. Just update the service
pack and msi installer. Then just install Flex Builder 2. In order to share
file between your VMWare windows 2000 and your linux host follow bellow:
http://www.vmware.com/support/ws4/doc/running_sharefold_ws.html
Hope this helps any of those people out there on Linux
-EvanPMeth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070212/6ee53eea/attachment.htm
More information about the Papervision3D
mailing list