dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: key press - spacebar - to just play

  1. #1
    Member
    Join Date
    May 2001
    Posts
    55

    Lightbulb

    Hi
    Just trying to make almost a pause button with the stop action..and then let the End User continue playing with the use of any key or the spacebar (key code = 32) ...
    so i have this movie clip (lets call it "hello" that i drop onto the main layer0
    with a small animation ... and on frame 10 i have the stop action ... and a movie clip called fake button..... and the code i have on that is...

    onClipEvent (keyDown) {
    if (Key.isDown(83)) {
    play ();
    }
    }

    what i want is for the MC "hello" to keep on playing.. so with the key press it will play frame 11 and onwards.

    what is this numptey doing wrong.... its either

    im having the wrong timeline play... not referencing it right..or
    I havent graduated from actionscripting 101 yet !

    aghhh... thanks for your help.
    Rye

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    onClipEvent (enterFrame) {
    if (Key.isDown( key.SPACE )) {
    play ();
    } else {
    stop ();
    }
    }

    Place that on the clip you want to play or stop. (if not the play() should wear the instance name of the targeted clip (ie _root.myMc.play())
    You can get rid of the "else" if you don't want the clip to stop on release of the space bar.
    gparis

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Posts
    21

    Start - Stop and Spacebar

    Here is what I'm trying to accomplish, When my movie opens it stops on frame one until you hit the spacebar. Then it plays until frame 20 where there is a stop() on frame 20. The movie will not start playing again until you hit the spacebar again. How do you code this action?? I have an onClipEvent but that controls the entire movie to start or stop.. not start and play until the next frame stop().

    Any suggestions would be GREAT!!!

    Thanks,
    Bill
    http://www.basher.net

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    onClipEvent (keyDown) {
    if (Key.isDown(key.SPACE)) {
    play ();
    } else {
    stop ();
    }
    }

    replace enterFrame by keyDown
    gparis

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