How to get instanceName/Object from MouseEvent.target


hello friends,

 

see got 3 movieclips

mcplanet

mcplanetouter

mcplanetinner

 

they in following fashion

 

mcplanet

 

        ----->instance of mcplanetouter : planetearthouter_mc

 

        ----->instance of  mcplanetinner : planetearthinner_mc

                            ----->planetinner_txt(instance of  dynamic textfield)

 

 

instance of mcplanet :  planetearth_mc.buttonmode = true

 

so if move mcplanet  both mcplanetouter , mcplanetinner , the planetinner_txt (mcplanetinner) should move propotionately, because of them under mcplanet

i set event target this,

 

planetearth_mc.addeventlistener(mouseevent.mouse_down, startmoving);

 


function startmoving(eventreceived:mouseevent):void {
    eventreceived.target.startdrag();

 

}

when  mouse down on planetearth_mc, planetearthouter_mc starts moving,  leaving  planetearthinner_mc and  planetinner_txt in same existing place.

 

i want call parent of target i.e. want move planetearth_mc.

also,

    eventreceived.target.parent.startdrag();   //gives error.

 

plz tell me how can achieve received  mouseevent object

 

 

i hope u understand this. plz me. first post.

 

thanks

 

venkat.

try using currenttarget instead of target.

 

if trace target, you'll see shows different thing currenttarget shows, , changes move on movieclip.  currenttarget captures object event listener attached it.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Nogen der kender et simpelt hvidt template med topmenu kun - Joomla! Forum - community, help and support

Installation database is corrupt

Error compiling for board Arduino/Genuino Uno.