PDA

View Full Version : Targeting MC



tranism
July 29th, 2003, 02:19 PM
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?


on (release) {
this.maskedimaged.gotoAndPlay(2);
}

thoriphes
July 29th, 2003, 02:55 PM
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").

kode
July 29th, 2003, 03:05 PM
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. :P

Voetsjoeba
July 29th, 2003, 03:12 PM
Simply refer to it from _root I guess.


on(release){
_root.whatever.maskedimaged.gotoAndPlay(2);
}

thoriphes
July 29th, 2003, 03:15 PM
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. :P 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*

kode
July 29th, 2003, 03:19 PM
I used to have a lot of problems with it too... not anymore since I don't use static event handlers. :thumb:

tranism
July 29th, 2003, 03:42 PM
its not working guys. I've tried


_root.maskedimage.gotoAndPlay(2);

_root._parent.maskedimage.gotoAndPlay(2);

maskedimage.gotoAndPlay(2);


sorry, i'm not just getting it. :(

Voetsjoeba
July 30th, 2003, 08:49 AM
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:


_root.container.maskedimage.gotoAndPlay(2);

tranism
July 30th, 2003, 11:57 AM
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. . .


on (release) {
tellTarget ("maskedimaged") {
gotoAndPlay ("playhead");
}
}

Voetsjoeba
July 30th, 2003, 12:02 PM
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 :P

tranism
July 30th, 2003, 01:36 PM
:) 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!