A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3: Timeline navigation with arrow keys in SWF

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    1

    AS3: Timeline navigation with arrow keys in SWF

    Hi,

    I'm trying to create an SWF which should play with right and left arrow keys instead of auto-play. I have created the .swf in AS3 but don't know the script to make it play with arrow keys. Can somebody please help me with the script for the same?

    Thanks,
    Kuldeep

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    place this code in the 1st frame
    PHP Code:
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;

    // if you need it,
    stop();

    function 
    handler (e:KeyboardEvent):void {
        if (
    e.keyCode == Keyboard.RIGHT) {
            
    nextFrame();
        }
    }

    // in case you come to this frame again
    stage.removeEventListener(KeyboardEvent.KEY_DOWNhandler);

    stage.addEventListener(KeyboardEvent.KEY_DOWNhandler); 
    who is this? a word of friendly advice: FFS stop using AS2

Tags for this Thread

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