A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: press a button on flash with space bar

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Location
    England!
    Posts
    21

    press a button on flash with space bar

    can someone please tell me how to make it so when you press the space bar itll go to another frame?
    o yeh, im using macromedia flash mx 2004
    i dunno what to put here so i wont put anything :P

  2. #2
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    on(keyPress "<Space>"){
    nextFrame;
    }

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Location
    England!
    Posts
    21

    nope thats doesnt work

    no, it doesnt work it comes up with error
    here is what it says:
    **Error** Scene=Scene 1, layer=Layer 1, frame=2:Line 1: Key code identifier expected
    on(keyPress <Space> ){

    Total ActionScript Errors: 1 Reported Errors: 1
    i dunno what to put here so i wont put anything :P

  4. #4
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    I edited the code... check it out now.

    You needed " " 's around the <Space> making "<Space>"

  5. #5
    Junior Member
    Join Date
    Feb 2005
    Location
    England!
    Posts
    21
    um, it doesnt say error, but when i press space bar it doesnt do anything
    i dunno what to put here so i wont put anything :P

  6. #6
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    I've never done anything like this, but lets hope it'll work.

    Try this code:
    PHP Code:
    frame 0;
    on(keyPress "<Space>"){
      
    frame += 1;
      
    gotoAndStop(frame);

    Try that code twice, first time copy and paste, second time replace gotoAndStop(frame); with gotoAndStop("frame");

  7. #7
    Junior Member
    Join Date
    Feb 2005
    Location
    England!
    Posts
    21

    o brilliant

    yeh thats works thanx a lot
    i dunno what to put here so i wont put anything :P

  8. #8
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    No problem, I thought you just wanted it to go to and stop on the next frame, that's far more complicated than gotoAndPlay.

    Good luck with your project

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