flash on 2010-6-22

by 9re
♥0 | Line 27 | Modified 2010-06-22 12:28:00 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.utils.setInterval;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var tf:TextField = new TextField;
            tf.width = tf.height = 465;
            var c:Number = 0;
            var sp:Sprite = new Sprite;
            var p:Number = 0;
            var t:Number = 0;
            //addChild(sp);
            setInterval(function ():void {
	            p++;
	            t = Math.sin(p * Math.PI / 180);
	            c += t;
	            sp.y += t;
	            log(c, sp.y);
	         }, 100);
            
            
            function log(...args):void {
            		tf.appendText(args + '\n');
            		tf.scrollV = tf.maxScrollV;
            }
            
            addChild(tf);
        }
    }
}