配列とfor

by h_sakurai
♥0 | Line 15 | Modified 2010-12-13 12:30:24 | MIT License
play

ActionScript3 source code

/**
 * Copyright h_sakurai ( http://wonderfl.net/user/h_sakurai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/BIxH
 */

package {
    import flash.display.Sprite;
    import flash.text.*;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            // write as3 code here..
            var names:Array = ["あいうえお","かきくけこ","たちつてと","さしすせそ"];
            for(var i:int=0;i<names.length; i++) {
                var t:TextField = new TextField();
                t.text = i + ":" + names[i];
                
                t.y = i * 20;
                addChild(t);
            }
        }
    }
}