flash on 2010-1-6

by hacker_yk666qry
♥0 | Line 36 | Modified 2010-01-06 12:36:52 | MIT License
play

ActionScript3 source code

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

package {
	import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import org.libspark.betweenas3.*;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var _tf:TextField = new TextField();
            _tf.text = "click to start!";
            addChild(_tf);
            
            stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        }
        
        private function onMouseUp(Event:MouseEvent):void {
        		while (numChildren > 0) {
        			removeChildAt(0);
        		}
        		
        		var box1:Box = addNewBox(50);
        		
        		//x: from 400 to current(60)
        		BetweenAS3.tween(box1, null, {x:400,y:300}).play();
        }
       
        private function addNewBox(y:Number):Box {
        		var box:Box = new Box();
        		box.x = 60;
        		box.y = y;
        		addChild(box);
        		return box;
        }
    }
}



import flash.display.Sprite;

internal class Box extends Sprite {
	public function Box() {
		graphics.beginFill(0x000000);
		graphics.drawRect(0,0,50,50);
		graphics.endFill();
	}
}