JR34
JR34

Reputation: 109

Button only works every other time in Flash

The "look around" button in my Flash project only works every other time you click it. All of my other buttons have the same code and work fine. Here's my ActionScript code:

import flash.events.Event;

escape_btn.addEventListener(MouseEvent.CLICK, pressedEscape)
function pressedEscape(event:MouseEvent):void
{
    animations.gotoAndPlay("escape");
}

bio_btn.addEventListener(MouseEvent.CLICK, pressedBio);
function pressedBio(event:MouseEvent):void
{
    gotoAndStop("biography");
}

home_btn.addEventListener(MouseEvent.CLICK, pressedHome);
function pressedHome(event:MouseEvent):void
{
    gotoAndStop("home");
}

analysis_btn.addEventListener(MouseEvent.CLICK, pressedAnalysis);
function pressedAnalysis(event:MouseEvent):void
{
    gotoAndStop("analysis");
}

lookaround_btn.addEventListener(MouseEvent.CLICK, pressedLookAround)
function pressedLookAround(event:MouseEvent):void
{
    animations.gotoAndPlay("look around");
}


stop();

here are some screen captures of my animation timeline: enter image description here enter image description here enter image description here enter image description here

Upvotes: 0

Views: 99

Answers (1)

user1901867
user1901867

Reputation:

I suspect the problem is in actions on same frame as "look around" label.

Im guessing there is a stop() command there; ive found when using gotoAndPlay, it can be buggy if you also have a stop() at the frame that gotoAndPlay is jumping to. Flash gets confused becausse it has been told to play but also to stop.

Upvotes: 1

Related Questions