A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Action on key (keyboard not mouse) press

  1. #1
    Member
    Join Date
    May 2000
    Posts
    30
    I want to skip to a certain frame in my movie when the user presses a certain key. No mouse actions involved at all!

    Is this possible, if so how?

    Thanks for the help...

  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    323
    in a button try the following

    on (keyPress "R") {
    gotoAndPlay (10);
    }

    I think you have to have had atleast one mouse event somewhere in you swf previously for this to work

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Location
    Virginia, USA
    Posts
    437
    This would be very dynamic if we can do something like this. every time a key pressed, we get the value (using Key.getCode() or Key.getASCII()) and assign to a variable. Then we convert that variable back to it value (if it is 65 then it is "A"), then we can call any frame which label "a","b", "c", etc dynamically using gotoAndStop(thisVarValue);

    We know we can create a function to convert a value back to character easily, but why Macromedia did not include that in Flash?

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    323
    whats wrong with

    chr(Key.getCode())

    ???

  5. #5
    Senior Member
    Join Date
    Jun 2001
    Location
    Virginia, USA
    Posts
    437
    PERFECT. I did overlook that function.

    Thanks.

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