命令列模式下編譯ActionScript3

來源:互聯網
上載者:User
命令列模式下編譯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:
  1. http://www.ubacoda.com/index.php?p=13
  2. http://stackoverflow.com/questions/10937431/run-a-swf-file-with-the-terminal
  3. http://code.google.com/p/as3term/

-

轉載請註明來自柳大·Poechant(鐘超)的CSDN部落格:Blog.CSDN.net/Poechant

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.