 | tell target alternative
on Jun 14, 2010 at 3:03:29 pm |
So I have "movieclip A"... inside that I have "movieclip B"
I want a button inside movie clip B to tell movie clip A (it's parent" to go to frame 1.
How should I do this?
thanks!
 | Re: tell target alternative on Jun 14, 2010 at 3:29:24 pm |
IF you have your file set up correctly, then you target it like this:
clipA.clipB.addEventListener(MouseEvent.CLICK, changeFrame);
function changeFrame(evt:MouseEvent):void{
clipA.gotoAndStop(1);
}
 | Re: tell target alternative on Jun 14, 2010 at 3:48:20 pm |
Thanks!
I copied and pasted your code and It gives me the following error message:
Symbol=INFOMERCIALS, layer=VI Statement must appear within on handler clipA.clipB.addEventListener(MouseEvent.CLICK, changeFrame);
 | Re: tell target alternative on Jun 14, 2010 at 6:58:58 pm |
sorry. but liike i said...... IF your file is set up correctly, that will work.
i assumed you have a main timeline, with a movieclip "A" ( you'll have to call it whateer you want, and change the insance name in the code) that has its own timeline. inside movieclip A is movieclip B.
if so, then yoiu are calling the button/movieclip B by its patway: movieclipA.movieclipB and you are telling movieclip A to goto and Play from its frame one :
movieclipA.gotoAndPlay(1) is the way to do it.
i did fully test it out .....
your error statement says that either you have things named differently, or your code is misplaced - all code should be on the first frame of the main timeline and not inside any movieclip.
i would have no idea what "..Symbol=INFOMERCIALS, layer=VI Statement.." is
however, the full code on the first frame of the main timeline would look something like this:
stop();
mc1_mc.stop();
mc1_mc.mc2_mc.addEventListener(MouseEvent.CLICK, changeFrame);
function changeFrame(evt:MouseEvent):void{
mc1_mc.gotoAndStop(1);
}
hope that makes sense and helps.