1.11M Members

Flash -action script 3 - first frame function vs last frame function

 
0
 

Hi, I'm having a problem with the stop() and play() functions
The first frame function works fine during the first run of the program
but as i hit space in the last frame ( go back to frame 0 ) the first frame function
saying whether to stop or play isnt working and pressing the space button always does
gotoandstop(0) .

any ideas?tried removing evenListeners but still nothing
this is the first frame function

import flash.ui.Keyboard;
import flash.events.KeyboardEvent;

stage.addEventListener(KeyboardEvent.KEY_DOWN, hearKeyyy);

function hearKeyyy(yourEvent:KeyboardEvent):void{
    if (yourEvent.keyCode==32){
        stop();
    };
    if (yourEvent.keyCode==13){
        play();
    };
};

this is the last frame function

stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, hearKey);
function hearKey(yourEvent:KeyboardEvent):void{
    if (yourEvent.keyCode==32){
        gotoAndPlay(0);
    };
};

thanks

You
Post:
Start New Discussion
View similar articles that have also been tagged: