Yes, that's what I think, but you can always try it both ways and use getTimer() to time a loop.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of thunderstumpgesatwork
Sent: Wednesday, August 16, 2006 11:45 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Determine if a Class implements an Interface

 

Thanks guys for the responses...

So, you think it would be faster to create a new instance and check
'is', even if the class was a visual component subclassed from like
HBox or ChartBase?

Sounds like I'll go with creating a new instance and checking it.

Thanks again.
Thunder

--- In [EMAIL PROTECTED]ups.com, "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> I'll bet that new'ing an instance of the class and using the 'is'
> operator on the instance will be faster than calling describeType() on
> the class and checking for an <implementsInterface> tag.
>
>
>
> - Gordon
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of Matt Chotin
> Sent: Tuesday, August 15, 2006 9:04 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: RE: [flexcoders] Determine if a Class implements an Interface
>
>
>
> describeType should be able to get you that info I think.
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of thunderstumpgesatwork
> Sent: Tuesday, August 15, 2006 5:42 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] Determine if a Class implements an Interface
>
>
>
>
> Hi all,
>
> I often use
>
> if (obj is MyClassOrInterface)
> {
> // do whatever
> }
>
> but it appears that only works with Instances not Classes. With just a
> Class, how can I tell if that class implements a particular interface
> or is of a particular base type? Do I have to create an instance of
> it and check the instance? I'm sure there must be another way...
>
> thanks in advance,
> Thunder
> __________________________
>
> var currentDomain:ApplicationDomain = ApplicationDomain.currentDomain;
> var psClass:Class = null;
> if (currentDomain.hasDefinition(sPropClass))
> {
> psClass = Class(currentDomain.getDefinition(sPropClass));
> }
>
> // below statement doesn't work!
> if ( (psClass != null) && (psClass is IPropertySheet) )
> {
> // make a new one of these classes.
> }
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to