A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Why does this work???

  1. #1
    Mind Chaos
    Join Date
    Oct 2006
    Posts
    96

    Why does this work???

    How come this works??

    Code:
    import flash.events.Event;
    
    DO KEY STUFF
    {Stuff}
    
    DO ENTERFRAME
    {Stuff}
    
    
    
    
    
    stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp);
    addEventListener(Event.ENTER_FRAME, everyFrame); //Do this every frame

    Why do these calls at the bottom repeatedly work, even though they're not executing every frame?
    [Don Kanonji]
    *crosses arms* WAAAAAAAAHAHAHAHAAHAHAHA!!!!!
    [/Don Kanonji]

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    The first two listeners work any time a key is pressed and released.
    The last one fires any time there is a frame tick which by default happens 24 times a second.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center