A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Function Keys

  1. #1
    Junior Member
    Join Date
    Jul 2001
    Posts
    17
    I am trying to get my movie to go from frame 2 to frame 3 when the user presses F4. I tried using normal mode to complete the ActionScript:

    on (keyPress "") {
    gotoAndStop (3);
    }

    but it won't add F4 for me. My Macromedia ActionScript reference guide tells me that I can use the key code 115 to represent F4, but when I go in to Expert mode and change the ActionScript to:

    on (keyPress "115") {
    gotoAndStop (3);
    }

    I get an error message saying I've entered an invalid key code. Please help!

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    148
    use the keyDown event handler like so:

    onClipEvent (keyDown) {
    if (Key.getCode() == 115) {
    gotoAndStop(3);
    }
    }

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Location
    Not on the dole any more
    Posts
    1,040
    Got there before me! But just to clarify -- OnClipEvents like this are palced in teh Object Actions of a movie clip. So you need to creae a movie clip (oruse an existing one, it doesn't matter). Select it in your scene, and click on the blue arrow in the Instance Panel. You can now enter Object Actions for that movie clip.

  4. #4
    Junior Member
    Join Date
    Jul 2001
    Posts
    17
    Hello. I actually already tried that (and tried it again by copying and pasting your ActionScript after the good advice) and it still won't go from 2 to 3 when I press F4. Any other thoughts...... What am I doing wrong aaaarrrrgggg

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Posts
    148
    It should work, did you get the target right for the timeline you want to move the playhead on. try:

    use the keyDown event handler like so:

    onClipEvent (keyDown) {
    if (Key.getCode() == 115) {
    _root.gotoAndStop(3);
    }
    }

  6. #6
    Junior Member
    Join Date
    Jul 2001
    Posts
    17
    Bingo! It must have been trying to go to frame 3 of the movie I applied the actions to instead of the root movie. I should have thought of that -- must be Friday. Thanks bunches!!! I'm the Flash expert here so if I have problems it's nice to know I can come here for advice. Thanks again.

  7. #7
    Junior Member
    Join Date
    Jul 2001
    Posts
    17
    OK, now I have another problem. In IE 5.5 F4 expands the address drop-down menu and the Flash movie never receives the keyboard command. Is there a way to have Flash get the browser to ignore the keyboard command? Maybe I have to look into some JavaScript...

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Posts
    148
    That's the danger of using function keys.

    I'm not sure how to get around that one... although I would have thought it possible using javaScipt.

    Is it nessacery to have them push the F4 button, can you not do it on a less problematic button?

  9. #9
    Junior Member
    Join Date
    Jul 2001
    Posts
    17
    I wish I could choose a different key, but I'm using Flash to simulate Excel, so I have to have them press F4. Thanks for your help, I'll look into the JavaScript avenue.

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