Results 1 to 2 of 2

Thread: working with buttons and multiple slides

  1. #1
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default working with buttons and multiple slides

    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.
    Last edited by jscheuer1; 09-16-2011 at 01:41 PM. Reason: formatting

  2. #2
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi evan, did you check this link to resolve it? http://www.actionscript.org/forums/a...3/t-37008.html

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •