man. THANK YOU! Kurt
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Glen Pike Sent: Thursday, June 18, 2009 5:38 PM To: Flash Coders List Subject: Re: [Flashcoders] assigning variable to a movie clip and a MOUSE_DOWN event e.target will change depending on what was clicked inside the thing you are listening to events from... If you want to know the thing sending the event - the thing you are listening to, use e.currentTarget This explains it a bit more: http://mysticnomad.wordpress.com/2008/03/21/difference-between-eventtarget-a nd-eventcurrenttarget-properties-in-an-event-object/ Kurt Dommermuth wrote: > Hi All, > > New to AS3. I'm enjoying it, but occasionally I run into issue where I > don't know even what to search for to learn more. > > The short of it is this: > > //The first line is using an object "o" to store the loader info. > //This was need because I had loaded an external swf and am loading > //assets from it's library into the main container. > > var asset_class = o.loader_info.applicationDomain.getDefinition("linkage > name") as Class; > var asset_mc:MovieClip = new asset_class() as MovieClip; > addChild(asset_mc); > asset_mc.my_variable = "some value"; > asset_mc.buttonMode = true; > asset_mc.useHandCursor = true; > > asset_mc.addEventListener(MouseEvent.MOUSE_DOWN, loadGame); > > function loadGame(e:MouseEvent):void > { > trace(e.target.my_variable); > trace(e.target) > } > > The trace will give me the expected value if I click on certain parts of > asset_mc. > > If I click on a nested movie clip it will trace as undefined. > > So, it seems that e.target changes depending on what I click on within > asset_mc. > > I had a similar problem when I used MOUSE_OVER instead of ROLL_OVER. > > Anyway, that target gives me a different value depending on what I click on. > Sort of makes sense, but how do I "drill down" to get to the variable I > assigned to asset_mc? I can think of ways, but it seems awfully convoluted. > > I think what I'm looking for is the "root" of asset_mc. How do I find it? > > Any ideas? > > Hope I'm making sense. > > Thank you, > Kurt > > > > > > > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > -- Glen Pike 01326 218440 www.glenpike.co.uk <http://www.glenpike.co.uk> _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

