命令列模式下編譯ActionScript3
- Author: 柳大·Poechant(鐘超)
- Email: zhongchao.ustc#gmail.com (#->@)
- Blog: Blog.CSDN.net/Poechant
- Date: August 5th, 2012
1 Flex Compiler Shell
要使用到的強大工具是 fcsh。它是 Flex Compiler Shell 的縮寫。如果你安裝過 SDK 的話,那麼可以通過如下命令尋找它:
sudo find / -name fcsh
我本機上有 3.6 和 4.6 兩個版本的 SDK,所以找到了兩個:
然後運行你找到的 fcsh 即可,注意它是與你安裝的 SDK 的版本對應的。
Michael:testspace michael$ /Applications/Adobe\ Flash\ Builder\ 4.6/sdks/4.6.0/bin/fcshAdobe Flex Compiler SHell (fcsh)Version 4.6.0 build 23201Copyright (c) 2004-2011 Adobe Systems, Inc. All rights reserved.(fcsh)
2 Example
(轉載請註明來自柳大·Poechant(鐘超)的CSDN部落格:Blog.CSDN.net/Poechant)
下面是一個樣本程式,先把它儲存在 Main.as。
package{ import flash.display.*; import flash.text.*; public class Main extends MovieClip { private var txt:TextField = new TextField(); private var txtFormat: TextFormat = new TextFormat( "Helvetica", 22, 0x333333); public function Main() { addChild(txt); txt.selectable = false; txt.autoSize = TextFieldAutoSize.LEFT; txt.text = "Hello World"; txt.setTextFormat( txtFormat ); txt.x = stage.stageWidth/2 - txt.width/2; txt.y = stage.stageHeight/2 - txt.height/2; } }}
3 Give it a try
然後在 fcsh 中鍵入如下命令:
(fcsh) mxmlc -o=/Users/michael/Development/testspace/Main.swf -file-specs=/Users/michael/Development/testspace/Main.as
然後可以使用 Flash Player 來播放看看:
哈哈哈哈哈,非常簡單,不是嗎?
4 How to run ActionScript3
你可以使用這個工具,很不錯哦~
啟動並執行方法就是:
Shift + Return
不過你用了之後可能就要吐槽了,它似乎並不能實現你的一些訴求,基本所有需要 import 的類都不能用(囧了個蛋蛋)⋯⋯
Reference:
- http://www.ubacoda.com/index.php?p=13
- http://stackoverflow.com/questions/10937431/run-a-swf-file-with-the-terminal
- http://code.google.com/p/as3term/
-
轉載請註明來自柳大·Poechant(鐘超)的CSDN部落格:Blog.CSDN.net/Poechant