Lets say that your custom component class is MyComponent. Are you trying
to determine whether the descriptor is for any instance of MyComponent,
or for a particular instance of MyComponent?
If it is the latter, I would do
if (someDescriptor.type == MyComponent)
rather than
if (someDescriptor.type.toString() == "class MyComponent")
In other words, use MyComponent as a Class literal value.
If it is the former, do
if (someDescriptor == myComponentInstance.descriptor)
- Gordon
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of gary_mangum
Sent: Wednesday, May 30, 2007 3:01 PM
To: [email protected]
Subject: [flexcoders] How to use UIComponentDescriptor "type" property
I want to use the 'type' property of the UIComponentDescriptor object
to find out if the component that it is describing is my custom
component.
The only way I have been able to do this so far is by calling
toString() on the 'type' property and doing a string compare with the
name of my custom component. This seems all wrong. It seems like I
should be able to do a compare with the 'type' property as is, or use
the 'is' operator or something, but so far I have been unsuccessful in
my attempts.
Any thoughts? I think I am missing something basic and obvious on
this one. :-)
Thanks again!