actionscript 3 - accessing functions between two (2) movieclip inside a nested movieclip AS3 -


ok im noob as3 since started, have 2 (2) movieclips inside movieclip, main mc called main_mc 2 movieclips inside named trigger_mc , move_mc, trigger_mc has instance name of start_ani, inside timeline of main_mc have code:

import flash.events.mouseevent;  start_ani.addeventlistener(mouseevent.click, correctans);  function correctans(e:mouseevent):void {     move_mc.animate(); } 

then created motion actionscript 3.0 using move_mc inserted code inside timeline of move_mc itself, , made function motion called animate, problem how access function between 2 movieclips both inside movieclip, know method not programming wise, kinda need learn this, pls me, badly need this, thank in advance.

parent property, not function - don't need ():

this.parent.move_mc.animate(); 

also, didn't mention instance name of move_mc movieclip, access above requires instance name move_mc - movieclip symbol name doesn't matter in actionscript.

update 1: clarify, said: trigger_mc has instance name of start_ani

good, code work:

start_ani.addeventlistener(mouseevent.click, correctans); 

but didn't say: move_mc has instance name of ???

so don't know if code work:

function correctans(e:mouseevent):void {     ???.animate(); } 

fill in ??? one.

update 2: know if click handler being fired? why not add trace statement?

function correctans(e:mouseevent):void {     trace("got click event!");     ???.animate(); } 

because click event, need:

start_ani.buttonmode = true; 

though say, isn't programming practice because assumes 2 movieclips siblings of same parent. it's not extensible. if they're not, code throw errors. keep in mind.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -