RE: AS 2.0 optimising.. 2004-03-16 - By Jim Cheng
Back Metanet Software wrote:
> so, what am i missing? because it seems to me that arrays are sort of > useless...
Arrays offer some additional functionality over using Objects in certain cases (numerical indexing, sorting, usage as a stack or queue, string expansion and concatenation). In these usages, the native methods are typically quicker than anything written in AS or even hand-coded FLASM, though this may vary for edge cases like specialized sorts.
However, if you simply need a dictionary (a.k.a. asssociative array), an Object works just as well with less cruft. Besides, you have the added advantage of being able to hide certain entries with the undocumented ASSetPropFlags method.
I tend to go with using Objects when I need a dictionary in AS, though Arrays certainly do have their uses in certain cases, say, string replacement:
newText = oldText.split('search').join('replace');
It's basically a matter of selecting the best tool for the job.
Regards, Jim
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107118 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|