RE: [Flashcoders] clone object

2006-08-25 Thread Karina Steffens
. So I'd say that some kind of check would be useful. Karina -Original Message- From: Scott Hyndman [mailto:[EMAIL PROTECTED] Sent: 25 August 2006 02:59 To: Flashcoders mailing list Subject: Re: [Flashcoders] clone object If you had one circular reference, you'd hit the recursion

Re: [Flashcoders] clone object

2006-08-25 Thread John Grden
you'd need some way of checking for circular references like Scott pointed out. Believe me when I say - i've been down that road several times with Xray. var obj = new Object(); obj.prop1 = new Object(); obj.prop1.prop2 = new Object(); obj.prop1.prop2.ref = obj.prop1; bingo, you'e into 256

Re: [Flashcoders] clone object

2006-08-25 Thread John Grden
Guess there's a first time for everything, eh? var obj = new Object(); obj.prop1 = new Object(); obj.prop1.prop2 = new Object(); obj.prop1.prop2.ref = obj.prop1; function clone(obj:Object):Object { var o = (null != obj.length) ? [] : {}; for (var i in obj) { o [i] = (typeof

RE: [Flashcoders] clone object

2006-08-25 Thread Steven Sacks | BLITZ
mailing list Subject: Re: [Flashcoders] clone object Guess there's a first time for everything, eh? var obj = new Object(); obj.prop1 = new Object(); obj.prop1.prop2 = new Object(); obj.prop1.prop2.ref = obj.prop1; function clone(obj:Object):Object { var o = (null != obj.length

Re: [Flashcoders] clone object

2006-08-25 Thread Jim Kremens
To: Flashcoders mailing list Subject: Re: [Flashcoders] clone object Guess there's a first time for everything, eh? var obj = new Object(); obj.prop1 = new Object(); obj.prop1.prop2 = new Object(); obj.prop1.prop2.ref = obj.prop1; function clone(obj:Object):Object { var o = (null

Re: [Flashcoders] clone object

2006-08-25 Thread John Grden
Grden Sent: Friday, August 25, 2006 6:37 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] clone object Guess there's a first time for everything, eh? var obj = new Object(); obj.prop1 = new Object(); obj.prop1.prop2 = new Object(); obj.prop1.prop2.ref = obj.prop1; function

RE: [Flashcoders] clone object

2006-08-25 Thread Wade Arnold
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Grden Sent: Friday, August 25, 2006 3:06 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] clone object I guess you'd be right about that. It'd be my problem - good point. while I'm

RE: [Flashcoders] clone object

2006-08-25 Thread Steven Sacks | BLITZ
Are you stalking me, Grden? :) 1. I use block comments all the time - but if you think it's janky, more power to you. I have the power of Greyskull. Block comments are for commenting out *gasp* blocks of code. I use block comments all the time for that very purpose. I use line comments to

Re: [Flashcoders] clone object

2006-08-25 Thread Johannes Nel
shouldn't you boys be going out and getting a drink on blitz's account instead of teasing each other like this? On 8/25/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote: Are you stalking me, Grden? :) 1. I use block comments all the time - but if you think it's janky, more power to you.

Re: [Flashcoders] clone object

2006-08-25 Thread John Grden
LOL I seriously think you may end up in a padded room with a box of crayons ;) OK, we're officiall OT - sorry mods! we're ending it here. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] clone object

2006-08-25 Thread John Grden
I'm not working for blitz at the moment ;) On 8/25/06, Johannes Nel [EMAIL PROTECTED] wrote: shouldn't you boys be going out and getting a drink on blitz's account instead of teasing each other like this? ___ Flashcoders@chattyfig.figleaf.com To

RE: [Flashcoders] clone object

2006-08-25 Thread Steven Sacks | BLITZ
I'm not working for blitz at the moment ;) Me neither while this keeps up! ;) ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you

Re: [Flashcoders] clone object

2006-08-24 Thread Scott Hyndman
Careful with circular references. Pretty easy to get that one in to exceed the 256 recursion limit. Scott On 23/08/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote: static function clone(obj:Object):Object { var o = (null != obj.length) ? [] : {}; for (var i in obj) {

RE: [Flashcoders] clone object

2006-08-24 Thread Steven Sacks | BLITZ
Careful with circular references. Pretty easy to get that one in to exceed the 256 recursion limit. Feel free to post an alternative. :) ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] clone object

2006-08-24 Thread Scott Hyndman
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

RE: [Flashcoders] clone object

2006-08-24 Thread Steven Sacks | BLITZ
If you're not willing to code a solution, then why are you bothering to write out an explanation? I have yet to encounter a recursion limit and I've parsed some deep object models. ___ Flashcoders@chattyfig.figleaf.com To change your subscription

Re: [Flashcoders] clone object

2006-08-24 Thread Scott Hyndman
If you had one circular reference, you'd hit the recursion limit. On 24/08/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote: If you're not willing to code a solution, then why are you bothering to write out an explanation? I have yet to encounter a recursion limit and I've parsed some deep

[Flashcoders] clone object

2006-08-23 Thread Wade Arnold
I have a style that I need to duplicate for several buttons. The style is declared once and then I want to duplicate the object and add a specific style element and then apply it to the button. However when I duplicate the object I get a reference to the original object, as expected. I tried to

Re: [Flashcoders] clone object

2006-08-23 Thread Jim Kremens
You know about mx.utils.ObjectCopy, right? Be sure to change the following lines to read accordingly: // var result:Object = new Function( refObj.__proto__.constructor)(); //change to: var result:Object = new (Function( refObj.__proto__.constructor))(); and // p[j]= q[j];

RE: [Flashcoders] clone object

2006-08-23 Thread Steven Sacks | BLITZ
static function clone(obj:Object):Object { var o = (null != obj.length) ? [] : {}; for (var i in obj) { o [i] = (typeof obj[i] == object) ? clone(obj[i]) : obj[i]; } return o; } ___