-
[F8] How do i control a function from a button inside a mc
This is the code for my cycle function on the main timeline:
var intID:Number;
var frame:Number = 0;
function playOn(){
if(frame == 2){
frame +=8;
}else{
frame +=10;
}
if(frame > 40){
frame = 2;
}
gotoAndStop(frame);
}
intID = setInterval(playOn,2000);
---------------------------------------------
I want my button to clear the function and then stop where it is. Shouldn't this work?
on (release) {
_root.clearInterval(intID);
_root.stop();
}
-
Banned
Dont write codes in your button. Use frames to write your codes.
example:
In frame#5:
yourButton.onRelease=function(){
clearInterval(intID);
}
Do you have the button script, the 'function' and setInterval declaration on the same frame?
-
i do now. The problem is when i click say button 5, it does three things:
1. Clears the interval
2. Stops on frame 5 (of main timeline)
3. Calls up a frame ("playbutton") inside a mc with a play button (playbutton_btn) on it.
The challenge right now seems to be trying to get 'playbutton_btn' to restart the function/interval again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|