flash on 2010-2-22

by gaina
♥0 | Line 26 | Modified 2010-02-22 00:35:33 | MIT License
play

ActionScript3 source code

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

package 
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;

	[SWF(width=800,height=800,backgroundColor=0xFFFFFF)]
	public class position3D extends Sprite
	{
		private var _shape:Shape;
		private var _n:Number = 0;
		
		public function position3D() {
			_shape = new Shape();
			_shape.graphics.beginFill(0x00FF00);
			_shape.graphics.drawRect( -100, -100, 200, 200);
			_shape.graphics.endFill();
			addChild(_shape);
			
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
		}
		
		private function onEnterFrame(event:Event):void 
		{
			_shape.x = mouseX;
			_shape.y = mouseY;
			_shape.z =10000+Math.sin(_n+=0.1)*10000 ;
		}
	}
	
}