I have a number of nav buttons that link to slides that are movieclips -and they work fine. What I am having trouble doing is having it keep track of the buttons that were used as in
btn_1 btn_2 btn_3 btn_4 have booleans assigned to them
like this:
Code:
//set up a boolean to each button
private var a:Boolean = false;
private var b:Boolean = false;
private var c:Boolean = false;
private var d:Boolean = false;
/*assign listeners to buttons to set value to true once they have been pressed and to check if all of them have been pressed so that a message can pop up to show the course is complete*/
public function Slide_0()
{
btn0.addEventListener(MouseEvent.CLICK, confirm_a, false, 0, true);
btn1.addEventListener(MouseEvent.CLICK, confirm_b, false, 0, true);
btn2.addEventListener(MouseEvent.CLICK, confirm_c, false, 0, true);
btn3.addEventListener(MouseEvent.CLICK, confirm_d, false, 0, true);
}
//each function looks like this:
public function confirm_a(event:MouseEvent):void
{
a = true;
GLSNav.instance.goToSlide(1);
/*here is the trouble -this code works were I NOT trying to navigate away from the page BUT, since I am every time I return to this navigation page the variables ALL go back to "false"*/
if (a && b && c && d ) { trace("num num num") }
else{trace("no cookie yet")}
}
//the other functions are just like this just copied
locally this works fine to test if all buttons were pressed -if not the trace statement says "no cookie" when all four are pressed the trace will say "num num num"
As stated, I want to be able to navigate to other slides and have AS3 REMEMBER the booleans were set to true instead of being set false all over again. any help is appreciated.
Bookmarks