Skip to main content
February 6, 2007
Question

Target a frame in a movieClip

  • February 6, 2007
  • 2 replies
  • 328 views
I have buttons in a movie clip which are placed on the main time line. I also have movieclips placed on single frames (25, 30, 35, etc) on the main time. When a button is released I want two things to happen -
- the playhead to go to a frame on the main time line where the movie clip is placed - which I can do with this code -
on (release) {
this._parent.gotoAndStop("25");
- then I'd like it to target a certain frame inside the movieClip with a var number (var number already generated). This is where I'm stuck. What is the path I use to target the frame inside the movie clip???

Thanks for any help,
Dave

This topic has been closed for replies.

2 replies

Inspiring
February 6, 2007
/* If you give everything instance names, it makes it alot easier to target.. even movie clips.

so say the movie clip on frame 25 has an instance name of animation_mc
you would use:
on(release) {this._parent.animation_mc.gotoAndPlay() };

or if you have movieClips inside movieClips, and you wanted to get back to the main timeline.. you could say: this._parent._parent._parent.blah.gotoAndPlay();

or you could simply say: _root.gotoAndPlay();

_root automatically tells Flash that you are reffering to the main timeline. */
February 7, 2007
It's still not working....

I named my movieClip (classifieds_mc) and my Var (collapse - which is a Number). I attached this code to the button (note: button inside movieClip than placed on main time line) -
on (release) {
//Movieclip GotoAndPlay Behavior
this._parent.classifieds_mc.gotoAndStop("collapse");
//End Behavior
}

Nothing hapens when the button is releases. If I just target the frame on the main time line with this code it works
on (release) {
this._parent.gotoAndStop("25");

But I'd like to also target a a frame inside the movieClip with a var Number.

Any help on what I'm doing wrong???..??

Thanks,
Dave
Inspiring
February 6, 2007

Create a var for the target frame of the MC in the first frame os the time line.
After that, create a conditional in the MC that must compare the current frame with the var:

if(this._currentframe != this._parent.yourvar ){
this.gotoAndStop(this._parent.yourvar);
}

(it can be on load)

When you click the button:

on (release) {
this._parent.yourvar=targetframe;
this._parent.gotoAndStop("25");
}