Issues with controlling state of boolean variable
Hi All,
I hope someone can help me out with this cos I'm proper stumped! The really annoying thing is that the code works fine everywhere else, except for when its applied to this one instance.
So basically, I have movie clips on the stage that I have addressed as buttons:
I have three variables set up:
var red_rewind:Boolean; - rewinds hit area animation
var red_txt_rewind:Boolean; - rewinds an explanation animation
var red_info_rewind:Boolean; - rewinds an information panel animation
These functions are initiated in the following code:
// red chairs;
function red_Initial(evt:Event):void
{
if (red_rewind == true)
{
MovieClip(evt.target).prevFrame();
}
if (red_txt_rewind == true)
{
this.sampson.prevFrame();
}
if (red_info_rewind == true)
{
this.redInfo.prevFrame();
}
}
function red_MouseOver(evt:MouseEvent):void
{
red_rewind = false;
red_txt_rewind = false;
red_info_rewind = false;
MovieClip(evt.target).play();
Object(this).mc_sweep.gotoAndStop(1);
this.sampson.play();
trace(red_info_rewind);
}
function red_MouseOut(evt:MouseEvent):void
{
red_rewind = true;
red_txt_rewind = true;
red_info_rewind = true;
Object(this).mc_sweep.play();
trace(red_info_rewind);
}
function red_Select(evt:MouseEvent):void
{
red_txt_rewind = false;
Object(this).redInfo.play();
trace(red_info_rewind);
}
Then I have attached a listener to the relevant object.
mc_red.addEventListener(Event.ENTER_FRAME, red_Initial);
mc_red.addEventListener(MouseEvent.MOUSE_OVER, red_MouseOver);
mc_red.addEventListener(MouseEvent.MOUSE_OUT, red_MouseOut);
mc_red.addEventListener(MouseEvent.MOUSE_UP, red_Select);
For some reason when I call the select function the variable flips from false, to true and then back to false again which causes the animation im trying to play to hitch and stop 1/2 way through.
I have used the exact same script on other objects in the file but with different instance names and they ALL work fine, this is the only one I can't get working. I have tried removing all other scripts to isolate this one but it makes no difference. I am properly stuck!
Hope someone can help,
Regards, Funk247