-
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.
-
.
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; q += 1; doCheck(); };
b.onRelease = function() { this._visible = false; q += 1; doCheck(); };
c.onRelease = function() { this._visible = false; q += 1; doCheck(); };
d.onRelease = function() { this._visible = false; q += 1; doCheck(); };
function doCheck():Void { if (q == 4) { trace("All invisible"); } else { trace("Not yet"); } }
-
Client Software Programmer
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.
-
.
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.
-
Client Software Programmer
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
-
.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|