# Targeting MC

**URL:** <https://forum.kirupa.com/t/targeting-mc/27046>\
**Category:** flash\
**Created:** [July 29, 2003, 6:19pm UTC](https://forum.kirupa.com/t/targeting-mc/27046 "2003-07-29T18:19:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tranism](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tranism/32/269_2.png) [@tranism](https://forum.kirupa.com/u/tranism)\
**Post date:** [July 29, 2003, 6:19pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/1 "2003-07-29T18:19:55Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 6:55pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/2 "2003-07-29T18:55:22Z")

</div>

take out “this.” and see if that works 😉

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”).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 7:05pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/3 "2003-07-29T19:05:40Z")

</div>

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. 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 7:12pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/4 "2003-07-29T19:12:12Z")

</div>

Simply refer to it from \_root I guess.

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 7:15pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/5 "2003-07-29T19:15:24Z")

</div>

> \*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. 😛 \*\*  
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** _

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 7:19pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/6 "2003-07-29T19:19:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 7:42pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/7 "2003-07-29T19:42:18Z")

</div>

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. ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2003, 12:49pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/8 "2003-07-30T12:49:23Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2003, 3:57pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/9 "2003-07-30T15:57:09Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2003, 4:02pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/10 "2003-07-30T16:02:20Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2003, 5:36pm UTC](https://forum.kirupa.com/t/targeting-mc/27046/11 "2003-07-30T17:36:39Z")

</div>

🙂 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. 😉 Thanks for all your helps peeps!
