fcwrap を動かすまでに必要なもの

AS3 (ActionScript 3) の開発を快適にするというfcwrap.とりあえず動かしてみた.AS3のコンパイルは時間がかかるので,fcwrap入れるとAS3のコンパイル&確認が楽になった.

  • 前提
    • OSはMac OS X (10.4.9)
    • flex_sdk_2 はダウンロードして,展開.flex_sdk_2/bin下にパスが通るようになっている
  • fcshを入れる
  • gems 周り
    • ruby & gems は MacPortsのもの
    • 何やらパッケージが足りないらしいので,エラーが出る度にgemsで入れる.

$ sudo gem install hoe
$ sudo gem install mongrel
$ sudo gem install rack

      • 一番最後のrackを知らず,rakeなら入っとるがな!と突っ込みを入れたのは内緒.
  • 本命 fcwrap

$ svn co svn://rubyforge.org/var/svn/hotchpotch/fcwrap fcwrap
$ cd fcwrap
$ sudo rake install_gem

<?xml version="1.0" encoding="utf-8" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
  layout="vertical"
  creationComplete = "initApp()" >
  <mx:Script>
    <![CDATA[
        public function initApp():void {
          mainTxt.text = Greeter.sayHello();
        }
    ]]>
  </mx:Script>
  <mx:TextArea id = "mainTxt" width="400" />
</mx:Application>
    • Greeter.as
package {
  public class Greeter {
    public static function sayHello():String {
      var greeting:String = "Hello World!!";
      return greeting;
    }
  }
}
    • fcwrap 経由で監視する

$ fcwrap -s HelloWorld.mxml

[04/11 10:24:34] Start Rack::Handler::Mongrel http://0.0.0.0:3001/
[04/11 10:24:34] Found update files: Greeter.as HelloWorld.mxml
[04/11 10:24:34] Compile Start
[04/11 10:24:39]  fcsh: Assigned 1 as the compile target id
Loading configuration file /your/path/to/flex_sdk_2/frameworks/flex-config.xml
/your/path/to/HelloWorld/HelloWorld.swf (133622 bytes)


わーい,表示された.

      • HelloWorld.xmlを書き換えても,Greeter.as を書き換えても,自動的に再コンパイルしてブラウザをリロードしてくれる.