Question

I have a movie clip called content. I want that when the mouse roll over the button, the content shows up and start playing the animation. Right now, When I mouse over, it play the movie clip, when I roll-out, it disappear which works fine. But the problem is the next time when I roll over again, nothing shows up. Any idea? Thank you in advance.

Here is my code:

code of the btn

btn.addEventListener(MouseEvent.ROLL_OVER, test);
function test(event:MouseEvent):void{
    content.visible=true;
    content.play();
}


btn.addEventListener(MouseEvent.ROLL_OUT, test2);
    function test2(event:MouseEvent):void{
    content.visible=false;
}

code for the movie clip:

Stop(); // 1st frame
Stop(); // last frame
Was it helpful?

Solution

You should replay your movie by using gotoAndPlay()

function test(event:MouseEvent):void{
    content.visible=true;
    content.gotoAndPlay(1);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top