|
Using ‘as’ can get confusing as it has a subtle gotcha.
‘as’ will return the object if it inherits from the target Class else
it returns null. This is great behavior until you try it with Classes that inherit
from Proxy. Example: myVar will be null, 100% of the time!!! var aCollection:ArrayCollection; var myArray:Array; aCollection = new ArrayCollection( [1,2,3] ); myArray = aCollection as Array; ArrayCollection does not inherit from Array, it holds an
array internally and uses Proxy to provide an alternative interface. Cheers, Ted Patrick Flex Evangelist Adobe Systems Incorporated From: Thanks for the reply, Matt. Is there any
performance difference between all three? I'm curious if doing any
casting at all is a performance hit. On 8/7/06, I don't think there should be a performance difference
between the two. Matt From: [EMAIL PROTECTED] I tend to
like to make my code autosense for me, so sometimes I do things like this:
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
__,_._,___ |
- RE: [flexcoders] any performance hit using "as"? Ted Patrick
- Re: [flexcoders] any performance hit using "as&q... Ralf Bokelberg
- Re: [flexcoders] any performance hit using "... Ralf Bokelberg
- Re: [flexcoders] any performance hit using &q... Pan Troglodytes
- RE: [flexcoders] any performance hit using &q... Ted Patrick
- Re: [flexcoders] any performance hit usin... Ralf Bokelberg
- Re: [flexcoders] any performance hit... Ralf Bokelberg

