Xray's trace used this method Scott and it's worked well.

my only issue was that adding a property to an object might cause some
"issue" or "bug" with someone's app.  However, to this day, it's not caused
any problems that I'm aware of ;)

I liked Keith's way of doing it, because I was able to send different levels
of recursion for different types of objects.  If I send in a MovieClip, can
just have it do 2-3 levels deep and htat's usually enough.  But for a true
object/array, I'll let it go at 254 or whatever.  This will be, btw,
configurable at runtime with Xray's interface.

On 8/24/06, Scott Hyndman <[EMAIL PROTECTED]> wrote:

I would mark each object (by actually assigning the cloned object as a
property of the original) as I go through each individual clone
operation, and keep a running array of what is being marked. If I hit
something that is already marked, I will use the clone instead of
copying the same object again (because it's hanging off the original).
When I'm finished, I'd remove all the temporary properties from the
originals.

This requires two method instead of one, and is a bit more CPU
intensive, but it won't break.

I'd also be sure to special case the handling of date objects.

The alternative is to shallow clone, which does not recursively copy
object properties, and instead assigns the reference held by the
original to the clone.

Scott

On 24/08/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote:
> > Careful with circular references. Pretty easy to get that one in to
> > exceed the 256 recursion limit.
>
> Feel free to post an alternative.  :)
>
> _______________________________________________
> [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




--
[  JPG  ]
_______________________________________________
[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

Reply via email to