onEnterFrame Event using Actionscript 3


/ Published in: ActionScript 3
Save to your folder(s)

Got this out of the o'reilly ActionScript 3.0 Cookbook


Copy this code and paste it in your HTML
  1. package {
  2. import flash.display.Sprite;
  3. import flash.events.Event;
  4.  
  5. public class ExampleApplication extends Sprite{
  6.  
  7. public function ExampleApplication(){
  8. graphics.lineStyle(1,0,1);
  9. addEventListener(Event.ENTER_FRAME, onEnterFrame);
  10. }
  11. private function onEnterFrame(event:Event):void{
  12. graphics.lineTo(Math.random() * 400, Math.random() * 400);
  13. }
  14. }
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.