[TextField]回してみたくなった

by stenpel
♥0 | Line 31 | Modified 2010-05-01 17:44:10 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.*;
    
    public class FlashTest extends Sprite {
    	private var tf:TextField;
    	private var container:Sprite;
    	 
        public function FlashTest() {
        	container = new Sprite();
        	addChild(container);
        	container.x = stage.stageWidth / 2;
        	container.y = stage.stageHeight / 2;
        	
        	tf = new TextField();
        	//tf.border = true;
        	tf.autoSize = "left";
        	tf.text = "テストTEST"
        	tf.addEventListener(Event.ADDED_TO_STAGE, onAdd);
        	container.addChild(tf);       
        }
        
        private function onAdd(e:Event):void {
        var tf:TextField = e.currentTarget as TextField;
        tf.removeEventListener(Event.ADDED_TO_STAGE, onAdd);
        tf.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        tf.x -= tf.width / 2;
        tf.y -= tf.height / 2; 
        }
        
        private function onEnterFrame(e:Event):void {
        	container.rotationY += 2;
        	container.rotationX += 3; 
        	       }
    }
}