View Full Version : A global button

06-08-2010, 04:11 PM
I'm working on a site and I have 2 movieClips/buttons that I would like to use as use as next frame/ previous frame triggers respectively. Is there a way to set the buttons up once and then access the functionality from the various levels of the site? Note that the prev/next buttons will not always be on the stage. Also note, I'm a beginner. Thanks in advance!

06-08-2010, 06:25 PM
Sure. Just remove and add them with scripting as needed.

06-08-2010, 07:46 PM
thanks for the reply. was hoping to get a little direction. i'm brand new to AS. i'm struggling with how to get the currentFrame of the current movieClip (by current movieClip i don't mean the button MC, I mean the frame of the movieClip that is currently being displayed). I've got a deadline I need to make and I've spent several hours on this. I'd really appreciate some help. Thanks

06-09-2010, 12:00 AM
here's what i've got so far but it's not working. i've been working on this for hours. is what i'm trying to do even possible? Need some way to get the current frame # of whatever MC is on the stage at that time, set it as variable and then increment it. no idea.

button.addEventListener(MouseEvent.CLICK, gotoNextFrame);

function gotoNextFrame(event:MouseEvent):void {
var curFrame = currentFrame+1

06-09-2010, 11:33 AM
What is wrong with the nextFrame method? Apart from that, just read the currentFrame property of the correct object.

06-09-2010, 11:43 AM
Thanks for the reply. I guess I'm not exactly sure how to read the currentFrame property of the correct object. I basically want to have these buttons on the stage once but be able to pass them parameters (I guess those would be the currentFrame and current movieClip) depending on what movieClip i'm inside. I want to be able to use them in different movieClips on the timeline. Does that make sense?