Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : button with counter


ing2
1/17/2006 8:49:46 PM
Hello I have a dynamic text box which will display a counter. The counter works
as soon as the flash piece plays. But i would like to have this counter begin
when a button is pressed and that is where i run into trouble. I've place the
code on the button and now the counter doesn't work. The code i put in the
button is the code that worked when it was placed on the first frame.
any suggestions? thanks!

Here is the code i am using:

on (release) {
if (GS_bttm3 == 0,Bttm2 == 0 ){

displayI = setInterval(displayF,100);
function displayF() {
if(icount == undefined) {
icount = 3530;
}
fuelPageCu.LeftNumber.text = String(icount);
updateAfterEvent();
icount++;
if(icount > 3780) {
clearInterval(displayI);
}
}

}else{
PopUpProcedures.gotoAndStop(3);

}

}


caskater
1/17/2006 11:42:08 PM
Make sure you are referencing your variables (movieclips, and so on) correctly.
For instance, if you have two movieclips on the main timeline called movie1 and
movie2 you can access both through actionscript in the main timeline saying
movie1 or movie2. However, if you place actionscript on movie1 or movie2 you
are now inside that movieclip and so you have to make sure calls are relative
to it. So if you're inside movie2 but want to access movie1 you would have to
say _parent.movie1.
ing2
1/25/2006 5:04:09 PM
thanks for the info, i think that's the problem but i double checked and it all
seemed okay with the referencing at the time. It is a new day so i'll look
again with fresh eyes. I had to start another project so that's why it's taken
me so long to reply. Thanks again.
AddThis Social Bookmark Button