Oh guys, this reminds me of var a:Object=new Object(); var b:Object=new Object(); a.b=b; b.a=a;
trace(a.b.a.b.a.b.a.b.a until I die) On 1/23/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > > shouldn't there be a === or !== in there somewhere to make > > sure you're talking about _exactly_ the same object rather > > than one which just has the same value..? > > Good question... > In my understanding - i.e. please correct me if I'm wrong! - when > testing objects for equality the simple and the strict equality operator > are completely interchangeable. > > We are not comparing values, which can be of different types (and thus > provoke 'false positives' with the simple equality operator), but > references, which have a simple, 'binary' quality: either they do point > at the same place in memory or they don't. > And two objects - by definition? - always occupy two distinct locations > in memory, completely independent of wether they are of the same type > and contain the same values. > > trace({} == {});// output: false > > That's why I think that when testing objects for equality, the simple > and the strict oprator will always return the same result. > > -------------- > Andreas Weber > motiondraw.com > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ian > Thomas > Sent: Montag, 23. Januar 2006 16:38 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] getting the name of an object > > > Andreas, > Just sight-reading the code rather than testing it - shouldn't there > be a === or !== in there somewhere to make sure you're talking about > _exactly_ the same object rather than one which just has the same > value..? > > Cheers, > Ian > > On 1/23/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > > > If you have a weakness for kludgy solutions, try the 'getObjNames' > > function below. > > Otherwise: don't 'forget' the names of the objects: store the name in > the > > same object, as an additional property. > > > > > > // 'don't try this at home!' > > > > a = {someProp:'someValue'}; > > b = {someProp:'someOtherValue'}; > > c = a; > > > > arr = [a, b]; > > > > > > // later, when we have 'forgotten' the names of the objects > > > > for(var i=0, len=arr.length; i<len; i++){ > > trace(getObjNames(arr[i]) + ' - someProp: '+ > arr[i].someProp); > > > > // Output: c,a - someProp: someValue > > // b - someProp: someOtherValue > > > > } > > > > > > // kludgy, poorly tested and a waste of processor cycles function > > getObjNames(o:Object, timeline:MovieClip){ > > var names:Array; > > var o2 = arguments[1] ? arguments[1] : _level0; > > if(!names){names = []} > > for(var p in o2){ > > if(typeof(o2[p]) == 'object'){ > > if(o2[p] != o){ > > getObjName(o, o2[p]); > > }else{ > > names.push(p); > > } > > } > > } > > return names; > > } > > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders