[ create a new paste ] login | about

Link: http://codepad.org/3zlixQCe    [ raw code | fork ]

Plain Text, pasted on Feb 26:
package 
{
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author test
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			graphics.beginFill(0xFF0000);
			graphics.drawRect(0, 0, 100, 100);
			graphics.endFill();
			
			var btn:SimpleButton = new SimpleButton();
			btn.x = 0;
			btn.y = 0;
			btn.width = 100;
			btn.height = 100;
			btn.addEventListener(MouseEvent.CLICK, onMouseClick);
			addChild(btn);
			
		}
		
		private function  onMouseClick(event:MouseEvent):void 
		{
			graphics.beginFill(0x0000FF);
			graphics.drawRect(100, 100, 100, 100);
			graphics.endFill();

		}
		
	}
	
 
}


Create a new paste based on this one


Comments: