Groups | Blog | Home
all groups > flash actionscript > august 2007 >

flash actionscript : Dynamic Pause/Play Toggle Button


NDempewolf
8/8/2007 9:14:22 PM
Hello,

I am attempting to create a toggle button that can play and pause the movie I
have on the main stage (scene 1). I also have tertiary navigation that will
allow the user to jump to a different part of the movie on the main stage.

http://www.baxa.com/testing/webdemos/em2400demo.swf

https://www.baxa.com/testing/webdemos/em2400demo.fla

What I Need:
I basically need the toggle button to track whether the user has paused or
unpaused the movie on the main timeline even when jumping through the tertiary
navigation (that allows the user to jump to different parts of the movie).

I can post actionscript code if needed.

Thank you in advance!

Noah


kglad
8/8/2007 9:42:50 PM
:



toggleBtn.onPress=function(){
if(!this.toggle){
_root.stop();
} else {
_root.play();
}
this.toggle=!this.toggle;
}

// toggleBtn.toggle can be used to determined whether the toggle button has
caused _root to play or stop
NDempewolf
8/8/2007 9:44:19 PM
kglad
8/8/2007 9:55:15 PM
NDempewolf
8/8/2007 10:00:32 PM
I attached he provided code and this works in pausing and unpausing the main
movie.

However, when the movie is paused and I click through the bottom tertiary
navigation, I have to click twice to get the movie to pause again.

Is this a timeline or an actionscript error?

Thank you agin for the help!
kglad
8/8/2007 10:18:22 PM
you'll need to use toggleBtn.toggle's value to assign actions to any other
controls of the main timeline (like your tertiary navigation). if you don't
understand how to do that, post a sample of your tertiary navigation code that
attempts to pause and unpause the main timeline.
NDempewolf
8/8/2007 10:32:46 PM
Hello Kglad,

Here is the code I have attached to my "Intro" button in the tertiary
navigation:

-------------

}
intro_mc.onLoad = function() {
intro_mc.reverse = false;
};
intro_mc.onEnterFrame = function() {
if (intro_mc.reverse) {
intro_mc.prevFrame();
}
};
intro_mc.onRollOver = function() {
intro_mc.reverse = false;
intro_mc.play();
};
intro_mc.onRollOut = intro_mc.onDragOut=function () {
intro_mc.reverse = true;
};
intro_mc.onRelease = function() {
gotoAndPlay("Intro");
};

----------

I'm not sure how to incorporate the toggle function into my tertiary
navigation. Again, your continued assistance with this is greatly, greatly
appreciated!

Thanks again!
Noah
kglad
8/8/2007 11:04:59 PM
if intro_mc is the same as _root, then use:



intro_mc.onRollOver = function() {
toggleBtn.toggle=false;
intro_mc.reverse = false;
intro_mc.play();
NDempewolf
8/9/2007 4:17:44 PM
kglad
8/9/2007 4:54:00 PM
AddThis Social Bookmark Button