Targeting MC

Ok this is probably obvious and real dumb but…I can’t seem to target a MC from my main timeline. I wanna tell my movieclip to start playing from frame 2 when an on (release) event handler is invoked from the main timeline. This is what I got but its not working. Help anyone?

[AS]
on (release) {
this.maskedimaged.gotoAndPlay(2);
}
[/AS]

take out “this.” and see if that works :wink:

whenever you use this, it refers to the object from where it’s called, in this case, a button. if you named your movieclip right (“maskedimages”).

It’s not like that, thor. :-\

Whenever you use this in the Button actions, it refers to the MovieClip that contains the Button. Confusing? Yeah, I know. :stuck_out_tongue:

Simply refer to it from _root I guess.

[AS]
on(release){
_root.whatever.maskedimaged.gotoAndPlay(2);
}
[/AS]

*Originally posted by kax *
**It’s not like that, thor. :-\

Whenever you use this in the Button actions, it refers to the MovieClip that contains the Button. Confusing? Yeah, I know. :stuck_out_tongue: **
gr…that darned “this” has been bugging me all week. i’ve had so many referencing problems with that 4-letter word.

I have been corrected.
bows

I used to have a lot of problems with it too… not anymore since I don’t use static event handlers. :thumb:

its not working guys. I’ve tried

[AS]
_root.maskedimage.gotoAndPlay(2);

_root._parent.maskedimage.gotoAndPlay(2);

maskedimage.gotoAndPlay(2);
[/AS]

sorry, i’m not just getting it. :frowning:

First of all, make sure your movieclips have instance names. Those are the names AS uses to know which movieclip you are talking about, and thus are used in the AS. For the first code to work, your movieclip should have the instance name “maskedimage”. You can assign an instance name to a movieclip when clicking on it. Then, in the Properties panel on the left, there’s a box that says “<instance name>” in light-grey. There, you should fill in the instance name you want to give the movieclip.

Also, the first code will only work when maskedimage is on the main timeline. If it is stacked inside another movieclip which is on the main timeline, with the instance name “container” for example, then it should look like this:

[AS]
_root.container.maskedimage.gotoAndPlay(2);
[/AS]

humm, none of the examples seemed to work but I did find another solution. I decided to use tell Target and that seemed to fix the problem. . .

[AS]
on (release) {
tellTarget (“maskedimaged”) {
gotoAndPlay (“playhead”);
}
}
[/AS]

I just took a closer look: You did change “maskedimage” in our examples to “maskedimaged”, right ? Otherwise, it’s pretty logical it didn’t work :stuck_out_tongue:

:slight_smile: no i didn’t change it. it should be “maskedimage”. What I wrote there was incorrect. Someone else told me that if you take another type of symbol and convert it into a movie clip, it won’t work. Sooo, that may be it but looks like we’ll never know. :wink: Thanks for all your helps peeps!