all groups > flash actionscript > august 2005 >
You're in the

flash actionscript

group:

Pause or Stop a FUNCTION



Re: Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:00:00 AM
flash actionscript: thanks for your reply,
did try clearInterval(scrollTitle) on the stop button with no success...
keeps on ticking as if nothing happened

Also tried these:
setInterval(scrollTitle, 0) --->ticking goes on mad
setInterval(scrollTitle, null) --->ticking goes on mad
setInterval(scrollTitle, -25) --->thought it my cancel the original 25, nothing

Help!


Re: Pause or Stop a FUNCTION JFincanon
8/11/2005 12:00:00 AM
hhhmm... that's odd... clearInterval should work. :confused;

Is the button on the same timeline as the function? Maybe the clearInterval
needs the path to the function?

I'll see if I can't think of something else as well.
Re: Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:00:00 AM
yep, the button is on the same timeline - just a different timeline layer
looks like the intervals are cleared out but reinitiated right away...

haven't found any solutions yet. thanks for helping me out JFincanon !
Re: Pause or Stop a FUNCTION JFincanon
8/11/2005 12:00:00 AM
Got it.

Instead of setInterval(scrollTitle, 25);, do this:
var scrollInt = setInterval(scrollTitle, 25);

then, do this on your button:
Re: Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:00:00 AM
this worked like a miracle for the stop function! thanks!!! var scrollInt =
setInterval(scrollTitle, 25);

my only issue now is I would like to reinitialize
the ticker when released of these buttons: SKIP FWD, SKIP BWD, PLAY/PAUSE.

How could I call back the function without making the function run over itself?
Re: Pause or Stop a FUNCTION JFincanon
8/11/2005 12:00:00 AM
For each time you want to restart it, just use

scrollInt = setInterval(scrollTitle, 25);

Re: Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:00:00 AM
yes it works, if I click once. (reinitialize)
But if I release PAUSE or SKIP BKWD, SKIP FWD etc.
These also contained the same scrollInt = setInterval(scrollTitle, 25);

Seems to had up and ticker runs mad... stop will not work too.
Anyways of tricking this?

Re: Pause or Stop a FUNCTION JFincanon
8/11/2005 12:00:00 AM
Try something like this:

play, fwd, bkwd buttons:
on(release){
if(_root.intRunning == false){
scrollInt = setInterval(scrollTitle, 25);
_root.intRunning = true
}
}

on stop button:
on(release){
clearInterval(scrollInt)
_root.intRunning = false
}


Let me know how that works.
Re: Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:00:00 AM
JFincanon your the man!!!!
everything runs in smoothly now, thanks a lot !
Pause or Stop a FUNCTION Detonate 2004
8/11/2005 12:28:23 PM
Hi Guys,
need some help with stoping or pausing a function.
Since this function is on my first frame on the timeline. It will continuously
initialize...
I would like to be able to stop or pause the function when you click stop
button.

On my button this code resets the ticking value:
top.title.txt.text = songTitel[current_song];
top.title._x = top.title_mask._x;

But it's not long before the text reappears...


--------------------------------------------------------------------------------
-------
Got this code on the main timeline:

// scrolling the display song title
function scrollTitle() {
top.title.txt.autoSize = true;
if (songTitel[current_song-1].length>15) {
top.title.txt.text = songTitel[current_song-1]+"
-->"+songTitel[current_song-1];
top.title._x+top.title._width/2+10<top.title_mask._x ?
top.title._x=top.title_mask._x : top.title._x--;
}
else {
top.title.txt.text = songTitel[current_song-1];
top.title._x = top.title_mask._x-2;
}
}
top.title.setMask(top.title_mask);
setInterval(scrollTitle, 25);




Code for STOP button:
on (release) {
MySound.stop();
mySoundPosition = 0;
pause_btn._visible = false;
play_btn._visible = true;

top.title.txt.text = songTitel[current_song];
top.title._x = top.title_mask._x;
}

Hope to get some help, thanks in advance!
Re: Pause or Stop a FUNCTION JFincanon
8/11/2005 1:25:30 PM
Add this to your on(release):


clearInterval(scrollTitle)

Let me know if that's what you are looking for.

AddThis Social Bookmark Button