|
Ralf, (Sorry I think my post was a bit confusing in retrospect.) ArrayCollection does not inherit from Array thus MyArray
will always return null. aCollection = new ArrayCollection( [1,2,3] ); trace( myArray == null ) //true With Proxy classes, inheritance
stops at Proxy. The Proxy types provide a low level way to redefine and rewire
a Classes interface. They are an excellent way to implement the façade or
adapter patterns in AS3. How proxy types work internally is a black box (up to
the developer), externally the types define an interface by overriding these
methods: callProperty - a method operation If you want to provide an alternate interface to any
object, Proxy is an excellent place to start. Here is some more background on Proxy: http://www.onflex.org/ted/2006/04/magic-with-flashutilproxy.php If you arrived here from FlashLand, Proxy is __resolver on
steroids. J Cheers, Ted J From: Hi Ted, On 8/8/06, Huh, Ralf. On 8/8/06, Ted
Patrick <
[EMAIL PROTECTED] 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: 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: [EMAIL PROTECTED] 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

