0
votes

I am trying to make a set of navigation buttons with flash/as3. I made it to where the text gets larger within several frames when clicked, and an effect to each button with several frames on rollover. However, since I added rollover effects, my clicks don't work anymore. I can't seem to find any resources online with my exact problem. Any ideas?

btw, i am new to actionscript, but my code is a simple set of event clicks and then some rollovers with gotoAndPlay("blah")/stop, separated on a frame label layer and an action layer with all the buttons on one layer (within a span of keyframes, etc.)

1
I added the onclick event listener inside the mouseover and mosueout one, but in order to have the click finish it's animation and proceed to the link, i have to stay targeting the button. - micker
Any way I can force the click to finish even if mouse out? - micker

1 Answers

1
votes

If you want to "force" the animation to finish playing, you can always set a variable blocking it:

var playing:Boolean = false;

function myClickFunction(e) {
    if(!playing) {
        e.currentTarget.play();
        playing = true;
    }
}

// and in the last frame of the animation, you would do:
playing = false;

However, this "playing" variable would count for all buttons so use with caution for it blocks them all. As for the rollover-event blocking the click-event, could you post some code?

Another way would be checking if the target is currently in one of those frames in which you want it to be able to be played. Like if(e.currentTarget.currentFrame == 0) instead of if(!playing), if you want it to allow playing only if its currently in frame 0.