View Full Version : Pause keyframe- -help, please
valpez1
April 24th, 2004, 01:20 AM
Hello Kirupians. This may or may not be an easy question, so please bear with me.
I need to a keyframe to pause (for say 20 seconds) when the frame is entered (i.e. not a button press, etc). After the 20 seconds is up, i need the timeline to continue playing to the next keyframe.
I've searched and searched for setinterval and the like, but i could not find a clear answer. If you could possibly take 3 minutes out of your time to help me out, i'd love you. :) Take care.
Victor.
Voetsjoeba
April 24th, 2004, 02:01 AM
Well the pause is achieved by just using stop() and have setInterval execute a function that plays the timeline after 20 seconds. Here's the code:
stop();
continuePlaying = function(){
play();
clearInterval(delay);
}
delay = setInterval(continuePlaying,20000);
valpez1
April 24th, 2004, 06:43 AM
Thanks for the reply, Voets. On my timeline, i have this type of setup(four keyframes, one right after the other):
Keyframe 1 and 2 contain AS for a preloader that, when finished loading, continues to third key frame. Right there on the third key frame is where i need the pause to happen, then naturally after the pause is finished it will continue playing to the 4th key frame which contains a stop(); action. I add your AS to the third keyframe, then go to preview it, but my Flash program continues to freeze on me.
Any ideas why this is happening? Am i not allowed to use setintervals directly after a preloader? Thanks for the help. Take care.
[edit] i actually left the program frozen and came to type the latter paragraph, then when i returned to the program, there was an error message saying something to the effect of:
"an actionscript is making your computer and application run slowly, continue with script?"
So i hit no, because i dont like my comp to be slow ;), then it takes me to my movie, but everything is blinking and going haywire. I'm very very confused here.
Victor.
Voetsjoeba
April 24th, 2004, 07:12 AM
That error is probably because of some infinite loop. I don't think my code produces an infinite loop since it doesn't loop at all, so I don't think that's the problem. Do you have any for() statements on that keyframe ? for() is an excellent weapon to create infinite loops. If not, can I see your file ?
valpez1
April 24th, 2004, 11:00 AM
My file is too large to upload here at the forums, and im yet to have a domain to upload it to. But on that frame, the only other code i have is:
var myDate = new Date();
var hour = myDate.getHours();
if (hour<12) {
this.gotoAndStop(2);
// morning
} else if (hour<12+6) {
this.gotoAndStop(3);
// afternoon
} else {
this.gotoAndStop(4);
// evening
}
That code is on frame 3 of a different layer above your code, and the code you gave me is on frame 3 of the layer below it. However, i have multiple 'for' actions on the fourth, and final, keyframe which also contains the stop action. I'm stumped and i really wish there was a way i could have you see the file....
Victor.
Voetsjoeba
April 24th, 2004, 11:34 AM
Well then it's likely that it's not the 3rd frame messing up but the fourth. I'd like to see the file though ... can you get it uploaded somewhere ... anywhere ?
valpez1
April 24th, 2004, 11:37 AM
I'll try and strip it down to the bare AS then upload it to a free server. Give me a minute and i'll post the link in here.
Victor.
Voetsjoeba
April 24th, 2004, 11:38 AM
I don't think the AS makes much of a difference in file size, rather anything inside it. Can you remove everything off the stage and send me the file ? I'm only interested in the ActionScript anyway. Don't forget to remove the items from the library as well.
valpez1
April 24th, 2004, 11:44 AM
So basically, all you want is the .fla with the multiple keyframes that contain the AS?
Voetsjoeba
April 24th, 2004, 11:45 AM
Yup.
Oh, I forgot, leave any symbols with actionscript on them on the stage, because they can also have code on them that screws things up.
valpez1
April 24th, 2004, 12:13 PM
OK Voets, I've done everything you've asked me to do, and i went to upload it to a free server, but the file was still too large :( I supposed the last ditch option we have is for me to just send you instructions on how to recreate my .fla step by step.....but i really, really dont want to burden you with that.
Voetsjoeba
April 24th, 2004, 12:15 PM
That would take waay too much time ... and I'd have to see your file to get that infinite loop out of there. How big is your file anyway ?? Are you sure you deleted everything not actionscripted from the library ?
valpez1
April 24th, 2004, 12:20 PM
Yep, i'm absolutely positive i deleted every symbol not needed for the AS from my library. And the file is still around a startling 12,000 KB's....i really dont understand how the file is that large though lol.
I guess ill just have to make two seperate files with the first file that redirects to the other after it completes it's animation. That is somewhat like a pause on the timeline, but just different .swf's
valpez1
April 24th, 2004, 12:37 PM
Thanks for your help anyway, Voets.
Victor
Voetsjoeba
April 24th, 2004, 01:44 PM
I'm sorry I can't help you out :( ...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.