Pause flash TimeLine …
14 06 2006So 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 .
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.