> please excuse my brain fatigue 

 

No problem, Maciek. Alex and I are actually identical twins. Even our
mom can't tell us apart.

 

; ) Gordon

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Maciek Sakrejda
Sent: Wednesday, May 28, 2008 12:48 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: UIComponents as Object keys and
Re-parenting

 

Heh heh, so it does. Long week. I think I read 

Gordon Smith
*A*dobe F*lex* SDK Team

As Alex.

Thanks you, Gordon--please excuse my brain fatigue.
-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com <http://www.truviso.com> 

-----Original Message-----
From: Tim Hoff <[EMAIL PROTECTED] <mailto:TimHoff%40aol.com> >
Reply-To: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
Subject: [flexcoders] Re: UIComponents as Object keys and Re-parenting
Date: Wed, 28 May 2008 19:38:30 -0000

Ha, looks like your name object was re-parented Gordon. :-)

-TH

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Maciek Sakrejda <[EMAIL PROTECTED]> 
wrote:
>
> Ah, that makes perfect sense. That's exactly the explanation I was
> looking for. Thanks, Alex.
> 
> -Maciek
> 
> 
> -----Original Message-----
> From: Gordon Smith <[EMAIL PROTECTED]>
> Reply-To: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: RE: [flexcoders] UIComponents as Object keys and Re-
parenting
> Date: Wed, 28 May 2008 12:20:14 -0700
> 
> An Object stores key/value pairs where the key is a String. When you
> write
> 
> 
> 
> map[foo] = "foo";
> 
> 
> 
> the 'foo' object gets automatically converted to a String, via its
> toString() method. UIComponents have a toString() method which 
produces
> a string indicating their location in the DisplayObject hierarchy, 
and
> this changes when you reparent a UIComponent.
> 
> 
> 
> You probably want to use a Dictionary instead of an Object. A 
Dictionary
> can store key/value pairs where the key can be an object and 
doesn't get
> converted to a string.
> 
> 
> 
> Gordon Smith
> 
> Adobe Flex SDK Team
> 
> 
> 
> 
> 
__________________________________________________________
__
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Maciek Sakrejda
> Sent: Wednesday, May 28, 2008 10:19 AM
> To: flexcoders
> Subject: [flexcoders] UIComponents as Object keys and Re-parenting
> 
> 
> 
> 
> I have a UIComponent (let's call it Foo) that extends Canvas. I'm 
trying
> to track various instances of this in an Object, mapping each 
instance
> to some String metadata. However, when I re-parent a Foo instance 
(by
> adding it to a new container), or I re-parent that parent 
container, it
> seems to be treated as a completely distinct key by the Object. For
> example
> 
> var map:Object = new Object();
> 
> var foo:Foo = new Foo();
> 
> map[foo] = "foo";
> for (var key:* in map) {
> // Output is something like 'key is Foo455'
> trace("key is " + key);
> }
> var bar:Bar = new Bar();
> bar.addChild(foo);
> 
> map[foo] = "re-parented foo"
> for (var key:* in map) {
> // Output is something like 'key is Foo455', 'key is Bar211.Foo455'
> trace("key is " + key);
> }
> 
> Am I missing something? It seems like putting a reference to the 
object
> in a map should not changed when that object is re-parented. Is 
there
> any way to do what I'm looking for? What's the reasoning behind this
> behavior.
> 
> -- 
> Maciek Sakrejda
> Truviso, Inc.
> http://www.truviso.com <http://www.truviso.com> 
>

 

Reply via email to