PDA

View Full Version : "goToAndPlay" goes to a blank screen!



artane
April 20th, 2004, 01:30 PM
I'm going insane!!!

All I want to do is go to frame 20 when the timer gets to zero. Instead, I go to a blank screen! I can replace "goToAndPlay" with "getURL" and it works (I go to the specified url) but, I want to go to frame 20! What in the world is wrong with this script?

Please help!


// This tells text field "sec2" to count down by subtracting one
set("/:sec2", (/:sec2-1));
// This states that if text field "sec2" is less than 0 then tell text field "sec1" to subtract one and add a nine in text field "sec2", hence completeing the seconds countdown.
if (/:sec2<0) {
set("/:sec1", (/:sec1-1));
/:sec2 = "9";
}
// This tells text field "min" to subtract one when text field "sec1" is less than zero, hence counting down the minutes then setting text fields "sec1" and "sec2" to 5 and 9 reseting the seconds
if (/:sec1<0) {
set("/:min", (/:min-1));
/:sec1 = "5";
/:sec2 = "9";
}
timeUp = (/:sec1 == 0) && (/:sec2 == 0);
if (timeUp) {
stop();
gotoAndPlay(20);
} else {
gotoAndPlay("restart");
}

claudio
April 20th, 2004, 02:12 PM
Create a textfield with the instance name mytextfield and apply this code on a frame of the timeline:


minutes = 2;//minutes to count
start = getTimer()/1000;
this.onEnterFrame = function() {
timeleft = Math.ceil((minutes*60)-(getTimer()/1000-start));
m = Math.floor(timeleft/60)<10 ? "0"+Math.floor(timeleft/60) : Math.floor(timeleft/60);
s = timeleft%60<10 ? "0"+timeleft%60 : timeleft%60;
mytextfield.text = m+":"+s;
if (timeleft<0) {
delete this.onEnterFrame;
gotoAndPlay(20);
}
};
stop();

artane
April 20th, 2004, 03:24 PM
Claudio! You are brilliant!

I've tried alot and that is the single best solution I've ever seen! Way to go!

Thanks alot man,

artane :)

claudio
April 20th, 2004, 03:29 PM
Welcome artane ;)