Conditionals + EnterFrame +MathRandom + Zeno's

(download)

 
var destMoveY:Number=pinball_mc.y; 
var destMoveX:Number=pinball_mc.x; 
 
pinball_mc.buttonMode = true; 
 
addEventListener(Event.ENTER_FRAME, onLoop); 
function onLoop(evt:Event) { 
	pinball_mc.x += (destMoveX-pinball_mc.x)/2; 
	pinball_mc.y += (destMoveY-pinball_mc.y)/2; 
 
	if ((pinball_mc.x - 0) <.5) { 
		destMoveX=400-pinball_mc.width; 
		destMoveY=Math.random()*(600-pinball_mc.width); 
	} 
	if (((400-pinball_mc.width)-pinball_mc.x )<.1) { 
		destMoveX=0; 
		destMoveY=Math.random()*(600-pinball_mc.width); 
	} 
} 
 
pinball_mc.addEventListener(MouseEvent.CLICK, clickPinball); 
function clickPinball(evt:MouseEvent) { 
	destMoveX=400-pinball_mc.width; 
	destMoveY=Math.random()*(600-pinball_mc.width); 
}