How do I make an image to move randomly on Flex? -


I have no information about this code, please help me

A few simple examples:

   & Lt; Fx: script & gt; & Lt ;! [CDATA [import mx.events.EffectEvent; Import spark effect. Personal Function Creation Text Handler (): Zero {_moveEffect = new Move (); _moveEffect.duration = 450; _moveEffect.target = image; Var timer: timer = new timer (1000); Timer AddEventListener (TimerEventTMER, TimerHandler); Timer.start (); } Private Function Timer Handler (Event: Timer Event): Zero {var xDest: int = image.x + getRandom (-100, 100); Var yDest: int = image.y + getRandom (-100, 100); If (xDest & lt; 0) xDest = 0; Else if (xDest> width) xDest = parent.width; If (yDest & lt; 0) yDest = 0; Else if (yDest> height) yDest = parent.height; _moveEffect.xFrom = image.x; _moveEffect.xTo = xDest; _moveEffect.yFrom = image.y; _moveEffect.yTo = yDest; _moveEffect.play (); } Personal Function getRandom (lower limit: number, high limit: number): int {return math.flur (mathematics.rendum) * (1+ hyphem-lomitit)) + less permit; } Private var _moveEffect: Move; ]] & Gt; & Lt; / Fx: script & gt; & Lt; / S: Applications & gt;    

Comments