最終更新:2010-11-20 (土) 01:46:07 (4906d)  

ActionScript 3.0
Top / ActionScript 3.0

Flash/Flex/AIR用のスクリプト言語

ActionScript 3.0/データ型

ActionScript 3.0/文法

変数の宣言

var hoge1:String = "Hello";
var hoge2:Number= 123;
trace(a);//デバッグ

偽と判断される値

  • false
  • 0
  • 0.0
  • NaN
  • ''(空文字)
  • null
  • undefined

for .. in文

for (var key:* in obj) {
    trace("key: " + key + ", value: " + obj[key]);
}

for each (.. in ..)文

for each (var value in obj) {
    trace("value: " + value );
}
trace(values);  // ['7', '5'] ※ 順番は保証されない

ActionScript 3.0/表示リスト

  • stage -> メインクラス (this)
package {
    import flash.display.Sprite;
    import flash.text.TextField;

    public class Sample extends Sprite {
        public function Sample()
        {
            var sprite01:Sprite = new Sprite();
            var text01:TextField = new TextField();
            var text02:TextField = new TextField();
            var text03:TextField = new TextField();

            text01.text = "1";
            text02.text = "2";
            text03.text = "3";

            text01.x = 0;
            text02.x = 50;
            text03.x = 100;

            // ディスプレイリスト(親子階層)の構築
            this.addChild(sprite01);
            sprite01.addChild(text01);
            sprite01.addChild(text02);
            this.addChild(text03);
        }
    }
}

パッケージ

ActionScript 3.0/ドキュメント

ActionScript 3.0/ライブラリ

コンパイラ

開発環境

関連

Javaとの違い

基礎文法最速マスター

参考