So you want to pause the time line for lets say for 5 seconds , And you dont know how to do that YET , here is the code with the sample file ๐
stop();
var nInterval = setInterval(Play, 5000);
function Play() {
clearInterval(nInterval);
gotoAndPlay(_currentframe+1);
}
so what does Every line mean …
stop();
//stop at your desired frame .
//Build the interval
// 1 second = 1000 milliseconds 1 x 1000
// setinterval(the-function , time[in milliseconds])
var nInterval = setInterval(Play, 5000);
/*function which will excute and clear the interval & Will play the next
Frame after 5 sec.*/
function Play() {
clearInterval(nInterval);
gotoAndPlay(_currentframe+1);
}
Files can be found @ Zainals
Thanks a lot for this script! This was exactly what I needed for my website! It works perfect and keeps my website low in kb’s!
Thanks again, Koen.
Glad it helped someone somewhere ๐
good to see ya arround .
i have a slide show that stops at each slide for 12 seconds and then goes to the next frame and plays. Everything works fine when i just let it play, however if i use the buttons (1-8) to jump to another slide before the 12 seconds is up it messes everything up. and if i go to another scene it seems to mess those up as well. i feel like the actionscript for the slide show starts to override all other actionscript within the movie.
Any suggestions would be greatly appreciated.
P.S. the only side show is on the home page or root timeline. all other actionscript within the movie are just simple ones like “stop and on press goto”.
I was told that i may need to add a clearInterval to all the button actionscripts, but i dont know how.
thnx mate, always handy to be able to stop the timeline. good script. cheers,
hey schande , tnx for dropping by and leaving & leaving a comment .
its been a while since i last posted anything about flash (“soon i will “) .
THx, this was exactly what I was looking for
cheers bud , good site you got there but you need a preloader …
i will post a video tutorial about Preloaders … so watch this space ..
This info was a Godsend! I couldn’t find anything like it in the regular training sites.
tnx sue , good 2 have ya around .
Awesome script. Simple and effective.
cheers kiki .
You have saved me hours of work! Now I don’t have to adjust each layer.
Thanks a lot!
Hey Andrew ,
cheers & welcome buddy !
Any idea how to be able to turn the pausing on and off? I am trying to creat a slideshow that someone can play through (with the pause script pausing to show the pic), or turn the pause off and use the “next/previous” buttons. Make sense?
-patrick
ShadowDetails.com
i dont exactly get it , but i think what you need is a boolean value …
eg ,
var en:boolean = true ;
// compare
if(en == true) {
// actions to do pausing
}else{
//actions to next/previous
}
u can use a button to change the value of your boolean variable …
i have given interval to my animation. it automatially goes to next scene after that interval. but now i want to add a stop button to it. even if i say stop (); on release event of the stop buttion, it does not stop. it goes to next scene after the specified interval
can i get help for this
hey buddy , you cant stop intervals by adding a stop(); event …
you have to kill your interval …
e.g
clearInterval(ID of your Interval );
Thank you have copy pasted your script. Have yet to try it out.
Will get back to you
hey penelopy , thanks for dropping by , let me know if you need further help with that one …
I have moved to http://www.zainals.com/blog
works like a dream. thank you so very dare you….
Cheers budd …
mad script…simple, effective, makes you wonder why there isnt a pause function within flashes own set.
thanks!!!
glad ya like it , i was wondering the same mate …
but there ya go … ๐
one thing i did notice though is that if you have audio with the movie, it can be a pain to work out the full length of the movie as the frame count doesnt take into account the pauses
clearly this is no ones fault (except perhaps Flash itself not having the pause function which would – or should – take into account those potential pauses)
anyway, once again, a great script ๐
hmmm , can you explain more ? i might be able to help mate …
btw i have moved to http://www.zainals.com/blog
here is the topic mentioned http://www.zainals.com/blog/2006/06/14/pause-flash-timeline/
What am I doing wrong.. I am just trying to make text appear for 5 seconds, then different text and so on.. For a testimonials list…
I have inserted the above code into a layer i have set aside for actions and it gives me an error? ๐ฆ
Hey andy … what kind of errors is that ?
Write it down and lemme have a look @ it …
please follow up on my new blog @ http://www.zainals.com/blog/2006/06/14/pause-flash-timeline/
Thanks Mohammed I have replied to the new blog ๐
Hey man…it works perfectly…that what i was looking for…cheers from Italy…
hey AdN cheers for the comments ๐
grazie , good to know i have readers from italy …
Thanks for this script, It is amazing how complicaated some other scripters were making something that I as a beginner thought should be so easy.
Thanks very much
dido what he said.
Thanks & Cheers
Below is another you can copy/paste into each (blank) keyframe in order to pause 3 seconds. It automatically resumes after.
Edub9
_root.pauseCount = 0;
function pause(pc)
{
if(_root.pauseCount == pc)
{
clearInterval(pauseInt);
play();
}
else
{
_root.pauseCount++;
}
}
pauseInt = setInterval(pause, 0, 300);
stop();
Great code snipped. Before this, I had to insert 100s of frames to “pause”. Thanks!!!
Thanks a lot for this code! thats exactly what i search for!
AWESOME!!!! I have been working on this for an hour…. that you so much for posting this code!
This was exactly what I needed! Thanks so much. You saved me a lot of time!
thanks for a simple script and a great way
who needs to pause for x seconds? i’m not sure where i’d use that. what i DESPERATELY need and for some reason can’t find on google ANYWHERE lol… is just how to put a very, very simple PAUSE button in my flash application. i don’t mind if i have to paste the code into every single movie clip i’m running, but there has GOT to be a way to pause a movie clip when you hit a button… not stop, but PAUSE it (so it freezes on whatever frame it’s on). then you hit the button again, and it plays from where it left off. simple!! how have the gods at Adobe made this so difficult? anyway, any tips appreciated!
Hi
About this codes to pause the timeline
Does this affect the main.swf if I’m loading a movie.swf into a holder_mc into the main.swf using loadMovie() with the code?
thanks in advance
trumoc
The code doesn’t seem to work if the code is inserted in the 2nd scene. It works only in the 1st scene. How do I go about?
Hi thanks for publishing this bit of code, it was very helpful!
Warm regards,
Ricardo
many thanks.
As a 1st trial I employed the pause timeline code to control a movieclip (it changes texts @ every 5 seconds ) that is into another movieclip ,a kind of bulletin pop up which comes up , when the flash site opens.
The text timing works perfectly until the button to close the pop up is pressed , which is simply a on (release) {gotoAndPlay(13);} , to command the pop up mc to go to the last frame , on which the txt mc instance is not present.
Yet as the pop up mc closes , the main time of the main mc @ _level10 , starts over & over ; I noticed that it obeys the timing stablished on the code of text movie clip. Is there a way to fix this trouble??
yes i too faced the same trouble, the button instances are overlapping the time stopped by the code kept and its not responding to some , i dont know y? here is what i have done…. all are in main stage.. i had stopped timeline for every 3 seconds and some buttons are there here and there to just from 1 place to other, when i click on the button when the code is working the next time the stop code( interval set to 3 sec) is not working and just playing normally. I dont know Y?
This is the problem i faced with the movieclip as Ron Wolpa (08:48:04) : said, so i placed all of them in main stage. still am getting this problem. can anyone help me solve this problem………?
Hello,
I also found the pause script to be very helpful! My only issue is when I loop my animation, the pause actions don’t seem to work anymore? They only work the first time the animation runs. Has anyone else found this to be a problem? Should I be using a special loop action to go with this particular pause code?
awesome..!
Thanks for the help! It helped me a lot! Cheers!
Hello,
My only issue is when I loop in diferente Scene its going to the original Scene frame. I replaced the “gotoAndPlay(_currentframe+1);” with “gotoAndPlay(“Scene 3″, 1);” and its not working. Is there a way to fix this.
Thanks
THX, U h3lp me a lot!
Mayby someDay I will help U!
CYa
Thanks for the script! Words great for my looping banner.
thx a lot.this is excatly i needed.
I have tried a couple of pause codes from here and other sites. I have a question regarding them. I have a series of say 5 images with forward and back buttons on each of them. If i press a forward or back button a few times it seems to mess with the timing of this whole thing. So no longer will each of the 5 images pause for 4 seconds they will each have different random times. Is there a way to over come this ?
Great ,thank you
Cheers from Sarajevo
Thanks. I’ve seen other versions of this but they have all been somewhat wrong. This one works great.
Hi
I’m a new Flash user and your code has helped me not only solve an imediate problem but also understand Flash AS2 a lot better – many thanks :o)
Stuart
Hello Stuart,
Glad to know that buddy, keep on rolling on flash and you’ll find that its all about logic, go to http://www.gotoandlearn.com for more video tutorials.
Z
This is awesome!
Thanks heaps for putting it up on the net…
Cheers
Douglas
Hey, how to make 2 scenes and after it ends. the first scene restarts at the begining but the 2nd scenes stop playing.
Kinda like this.
How to make 2 scenes, first and second scene play at the same time, then while at the end, the first scene restarts at the begining but the second stops playing again?
help please
thanks brother
Zainal, thank you very much.peace
Zainal, thank you very much.
awesome. thanks.
Hi
I love your site, so helpful! Have been trying your script on how to pause a movie for a few seconds and it’s not working!!!! why!!!! I’ve copied your exact script into a blank keyframe on a new layer……what am I doing wrong? getting very impatient with this…..please help me!! Thanks
Have a look at this to show how to very simply stop the timeline on the click of one button and start it again on the click of another. AS2
http://www.kirupa.com/developer/mx2004/pause.htm
It’s 2010 and this post helped another person. Best regards ๐
wow! Glad to know that Adi ๐
i have a slide show that stops at each slide for 12 seconds and then goes to the next frame and plays. Everything works fine when i just let it play, however if i use the buttons (1-8) to jump to another slide before the 12 seconds is up it messes everything up. and if i go to another scene it seems to mess those up as well. i feel like the actionscript for the slide show starts to override all other actionscript within the movie.
Any suggestions would be greatly appreciated.
P.S. the only side show is on the home page or root timeline. all other actionscript within the movie are just simple ones like โstop and on press gotoโ.
I was told that i may need to add a clearInterval to all the button actionscripts, but i dont know how.
so helpful, just what i was looking for!! thanx so much!
This script is actually AMAZING, but it does make Flash do funky things in many browsers…
Thanks, just what i need for pausing my animation.
That is a piece of a good code. Hope the will be more of that comming soon. Thx
This was posted in 2006 and still we use it in 2011 this code is simple and works wonderfull thanks alot for it.
PS: Don’t delete this post in like ever lol
This was posted in 2006 and still we use it in 2011 this code is simple and works wonderfull thanks alot for it.
PS: Donโt delete this post in like ever lol
Thanks mate,,
it’s wonderful code..
Thanks dear,
It’s really good code…
once again thanks