A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: gotoAndPlay when all buttons not visible

  1. #1
    Registered User
    Join Date
    May 2015
    Posts
    1

    gotoAndPlay when all buttons not visible

    Hi there, This is my first time posting and I'm new to Flash and ActionScript 2.0 so forgive my "newbie-ness".

    I have a frame with 4 images as buttons that become not visible when they are clicked. This is the code:
    Code:
    stop();
    
    btn_limeJuice.onRelease = function(){
    	btn_limeJuice._visible = false;
    }
    
    btn_ice.onRelease = function(){
    	btn_ice._visible = false;
    }
    
    btn_tequila.onRelease = function(){
    	btn_tequila._visible = false;
    }
    
    btn_cointreau.onRelease = function(){
    	btn_cointreau._visible = false;
    }
    The problem I have is I can't figure out how to gotoAndPlay when all the buttons have been clicked. I've tried adding this to the end:

    Code:
    if(btn_limeJuice == false && btn_ice == false && btn_tequila == false && btn_cointreau == false) {
    	gotoAndPlay(44);
    }
    But it's either not the right code or I'm putting it in the wrong place. Whatever I've done wrong, it doesn't work.

    Any help is greatly appreciated :-) Cheers.

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You could do something as simple as this, I havent use your button names though.
    PHP Code:
    stop();

    var 
    q:Number 0;

    a.onRelease = function()
    {
        
    this._visible false;
        
    += 1;
        
    doCheck();
    };

    b.onRelease = function()
    {
        
    this._visible false;
        
    += 1;
        
    doCheck();
    };

    c.onRelease = function()
    {
        
    this._visible false;
        
    += 1;
        
    doCheck();
    };

    d.onRelease = function()
    {
        
    this._visible false;
        
    += 1;
        
    doCheck();
    };

    function 
    doCheck():Void
    {
        if (
    == 4)
        {
            
    trace("All invisible");
        }
        else
        {
            
    trace("Not yet");
        }


  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    stop();

    onEnterFrame = function(){
    if(btn_limeJuice._visible == false && btn_ice._visible == false && btn_tequila._visible == false && btn_cointreau._visible == false){
    gotoAndPlay(44); // your task
    }
    }

    btn_limeJuice.onRelease = function(){
    btn_limeJuice._visible = false;
    }

    btn_ice.onRelease = function(){
    btn_ice._visible = false;
    }

    btn_tequila.onRelease = function(){
    btn_tequila._visible = false;
    }

    btn_cointreau.onRelease = function(){
    btn_cointreau._visible = false;
    }
    Last edited by AS3.0; 05-26-2015 at 08:29 AM.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You would want to delete the onEnterFrame with Alloys too.

    PHP Code:
    stop();

    onEnterFrame = function ()
    {
        if (!
    btn_limeJuice._visible && !btn_ice._visible && !btn_tequila._visible && !btn_cointreau._visible)
        {
            
    delete onEnterFrame;
            
    gotoAndPlay(44);
        }
    };

    btn_limeJuice.onRelease = function()
    {
        
    this._visible false;
    };

    btn_ice.onRelease = function()
    {
        
    this._visible false;
    };

    btn_tequila.onRelease = function()
    {
        
    this._visible false;
    };

    btn_cointreau.onRelease = function()
    {
        
    this._visible false;
    }; 
    I personally try to use as little onEnterFrames as possible.

  5. #5
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Good call, might want to clean up after that bloat mess lol but if thats around as big as his script will get, even double those lines it should do

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I don't understand you Alloy, are you mocking her code

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center