PDA

View Full Version : SetInterval ?


flashcdog
04-02-2004, 08:53 PM
ActionScript Novice here! :)

In my main timeline on the first frame setting a pause function using the following:


stop();
function pause(){
play();
clearInterval(timer);
};


Later down on the main timeline I calling the function as follows:


stop();
timer = setInterval(pause, 3000);


All that works fine.

But here is the problem.

I also want to call it from inside an MC I have placed on the stage.

Is this function global? If so how would I call it inside another clip? _root.something?

Basically I want to pause segments of the timeline inside that MC.


As always any help would be greatly appreciated.

Billy T
04-02-2004, 10:57 PM
try

stop();
function pause(targ){
targ.play();
clearInterval(timer);
};

then from any timeline

_root.timer = setInterval(_root.pause, 3000,this);

the 'this' refers to the timeline you want to pause

cheers

flashcdog
04-03-2004, 09:48 AM
That worked! But of course you knew that. :p

Thank you very much.

One question if I might... being a novice and all.

What does (targ) in the statement do... I am sure its obvious, but I am a novice.

Only asking so I don't bother you gurus with more silly questions. :)

Billy T
04-03-2004, 11:55 AM
targ could be called anything you want ... its just a parameter you provide to your function...in this case we provide a reference to the timeline you want to target

hope that helps

cheers

flashcdog
04-03-2004, 12:00 PM
I got it...

I didn't think about it as a reference.


Thank you very much Billy T for taking the time to respond to my questions.

I really appreciate.


I have come to find that as long as an individual is making an effort, the actionscript community is very supportive.

Thanks again Billy T.

Billy T
04-03-2004, 12:03 PM
more than welcome

cheers