Hello :)
my article about the for..in enumeration in AS3 vs AS2 in french ...
http://www.ekameleon.net/blog/index.php?2007/01/30/60-as2-vs-as3-enumerations-avec-un-forin
but you can Bablefish or google translator to translate the article and the
ActionScript is ActionScript :)
You must use a dynamic class to enumerate the content with for..in and not
use public var declaration of the properties !
EKA+ :)
2007/2/16, Matt Garland <[EMAIL PROTECTED]>:
Thanks Mike, you are the man.
I didn't use setPropertyIsEnumerable, because adding that for every
property would be as much typing as writing a custom conversion
function.
But describeType, that's the trick. It converts class info into XML.
Info is easily accessible with EX4 syntax, one of the many things
that makes AS3 a joy.
Message: 17
Date: Thu, 15 Feb 2007 21:24:28 -0800
From: "T. Michael Keesey" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] for...in property access replacement in
AS3?
To: "Flashcoders mailing list" <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset=UTF-8; format=flowed
You can use Object.setPropertyisEnumerable(propName).
flash.utils.describeType() might be another way.
--
Mike Keesey
On 2/15/07, Matt Garland <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm converting some AS2 code to AS3. The code manipulates several
> big, complicated data containers to produce an animation.
>
> In AS2, the data container was a vanilla object. In AS3, for
> performance gains, I turned these containers into several classes.
>
> The problem is, at various points, I am transferring all the values
> from one container to another. The variables have the same names, but
> the data containers are different. For instance, in the first
> container, there are points. In the second container,the
> corresponding points are actually a subclass of points, one with more
> properties.
>
> Before, I could just lay the two containers side by side, then use
> recursive for...in loops to transfer all the values. But for...in
> loops don't work for class instances in AS3. Class info is baked into
> the compiled class, and no longer stored in a memory- and cycle-
> wasting object hash.
>
> What to do?
>
> Anyway I can access the compiled class info (looping through a
> class's properties), or is that contra the entire point of AS3?
>
> Save me from writing a long, convoluted one-off conversion function.
>
> Thanks
>
> Matt
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com