Handling Events: a simple application that draws successive random lines : Event « Development « Flash / Flex / ActionScript






Handling Events: a simple application that draws successive random lines

 

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class Main extends Sprite {
        
        public function Main(  ) {
            graphics.lineStyle(1, 0, 1);
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        private function onEnterFrame(event:Event):void {
            graphics.lineTo(Math.random(  ) * 400, Math.random(  ) * 400);
        }
    }
}

        








Related examples in the same category

1.Event Listener Priority
2.Add Event listener
3.Responding to Event.ACTIVATE and Event.DEACTIVATE
4.Listeners for the Event.RESIZE event must be registered with Flash Player's Stage instance,
5.The Event.MOUSE_LEAVE Event
6.Responding to Event.RESIZE.
7.Preventing Default Event Behavior