mxmlc生成swf
Compiling an AS3 program with the Flex SDKHere,we will describe how to compile with mxmlc. This assumes that your Flex framework is properly installed. For information on how to install it,read the Adobe Flex article. Open a text editor,a simple one that will save the text as it appears on the screen,without any formatting. In that new text file,copy the following code: package { import flash.display.Sprite; public class FilledCircle extends Sprite { function FilledCircle():void { var circle:Sprite = new Sprite(); circle.graphics.beginFill(0xFF794B); circle.graphics.drawCircle(50,50,30); circle.graphics.endFill(); addChild(circle); } } } Save the file as text and give it the name of "FilledCircle.as".? Take good note of the directory in which you save that file. Preferably,put it in a? folder quite high up in the hierarchy. We will assume that the file is stored somewhere defined by "pathtofile". 2.1 On a mac
cd pathtofile mxmlc FilledCircle.as 2.2 On a PC
cd C:Flex SDK 2bin mxmlc C:pathtofileFilledCircle.as The mxmlc executable will compile the program and generate a .swf file name FilledCircle.swf. To run the file,open it in the Flash Player on your desktop or in a web browser that has Flash Player installed. Note that Flash Player 9 needs to be installed to view swf files generated by the Flex compiler. 2.3 On a PC by modifying the Path variableA more practical solution is to add the path of the Flex SDK to your system: %Path%;c:Flex SDK 2bin See environment variable for technical details if the instructions below are not enough. On a french speaking Windows XP system (sorry) the procedure is:
On an English system (sorry you may have to fix this a bit):
Then:
%Path%;c:Flex SDK 2bin
Do not remove the other pathes ! Do not edit the system variables or you may regret it bitterly,because your system will stop working if do it wrongly. ! Here is a screendump showing some of the (french) Windows panels: If you have done this right,you now can use the compiler from any place,e.g. cd c:softas3ex1 mxmlc FilledCircle.as 2.4 Under LinuxYou should add the path to the flex binaries somewhere,e.g. if you installed flex in /usr/local/flex,add this line to /etc/bash.bashrc export PATH=${PATH}:/usr/local/flex/bin Note: MacOSX users also could do something like this (but DKS doesn't have a Mac at hand to show how-to). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |