flash on 2011-3-27

by quail24eggs
import flash.geom.Transform;
import flash.geom.Rectangle;
♥0 | Line 29 | Modified 2011-03-27 22:53:19 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.geom.Matrix;
    
    public class Main extends Sprite {
        public function Main():void {
            var x:int = 1;
            
            while (x < 5)
            {
                var sp:Sprite = new Sprite();
                sp.graphics.beginFill(0xFFFFFF * Math.random());
                sp.x = 100 + 40 * x;
                sp.y = 100 + 40 * x;
                sp.alpha = 0.3; //透過
                sp.graphics.drawRect(0,0,100,100);
                sp.name = "sp" + String(x);
                
                this.addChild(sp);
                trace(sp.x);
                
                //?表示されない。
                var tF:TextField = new TextField();
                tF.x = sp.width/6;
                tF.y = sp.height/6;
                tF.text = "test"+String(x);
                sp.addChild(tF);
                
                trace(tF.x);
                //テキストここまで
                
                x++;
            }            
            
            /*
            var aiu:Matrix = sp.transform.matrix;
            aiu.scale(1.5, 1.2);
            aiu.rotate(Math.PI / 4);
            aiu.translate(300, 0);
            sp.transform.matrix = aiu;
            trace(sp.x);
            */
        }
    }
}