Groups | Blog | Home
all groups > flash actionscript > august 2005 >

flash actionscript : Same code in on two buttons.One doesn't work.


LSNsaltlamp
8/16/2005 11:46:58 PM
I have the following code on two buttons in one of my movies. However one of
them only does the first command, then stops. I can't think of any reason for
these two buttons to be behaving differently. The only difference is the last
line of code on the second one says _root.titlebar.titles.gotoAndPlay
("database_cleanup")

on (release) {
_root.leftmenu_products.gotoAndPlay ("fade_out")
}
on (release) {
var idl = setInterval (function () { _root.leftmenu_home_alone.gotoAndPlay
("fade_in"); clearInterval (idl); }, 2000);
}
on (release) {
_root.titlebar.gotoAndPlay ("go");
}
on (release) {
var idt = setInterval (function () { _root.titlebar.titles.gotoAndPlay
("market_research"); clearInterval (idt); }, 1250);
}

Why are they responding differently.
kglad
8/17/2005 12:00:00 AM
why do you have 4 release handlers? you have a problem allowing duplicate
setInterval() statements. and does _root.titlebar.titles exist when
_root.titlebar has played past "go"? if the later answer is yes, try:

on (release) {
_root.leftmenu_products.gotoAndPlay("fade_out");
_root.titlebar.gotoAndPlay("go");
clearInterval(idt);
var idt = setInterval(function () {
_root.titlebar.titles.gotoAndPlay("market_research");
clearInterval(idt);
}, 1250);
clearInterval(idl);
var idl = setInterval(function () {
_root.leftmenu_home_alone.gotoAndPlay("fade_in");
clearInterval(idl);
}, 2000);
}
LSNsaltlamp
8/17/2005 12:00:00 AM
I tried your code and it still stops after:
_root.leftmenu_products.gotoAndPlay("fade_out");

all of my buttons have the same code, just with different frame references and
the rest of them work fine. This doesn't make any sence.
kglad
8/17/2005 12:00:00 AM
LSNsaltlamp
8/17/2005 12:00:00 AM
kglad
8/17/2005 9:14:40 PM
kglad
8/18/2005 12:00:00 AM
LSNsaltlamp
8/18/2005 8:29:51 AM
The instance undergoes a motion tween that makes it 1 pixel thick and makes it
leave the stage. However it never ceases to exist. It remains the same instance
of the button throughout the whole process; ending with a stop () command. This
is the same thing that happens to all of the other buttons in the menu. The
only difference is that this one is the first to leave the stage.
LSNsaltlamp
8/19/2005 12:00:00 AM
The code stops executing. I have to code:

on (release) {
_root.leftmenu_products.gotoAndPlay("fade_out");
_root.titlebar.gotoAndPlay("go");
clearInterval(idt);
var idt = setInterval(function () {
_root.titlebar.titles.gotoAndPlay("market_research");
clearInterval(idt);
}, 1250);
clearInterval(idl);
var idl = setInterval(function () {
_root.leftmenu_home_alone.gotoAndPlay("fade_in");
clearInterval(idl);
}, 2000);
}

on my button. On release _root.leftmenu_products. plays fade_out and then
nothing else in the script executes.
kglad
8/19/2005 12:00:00 AM
AddThis Social Bookmark Button