[Flashcoders] Enumerating properties from outside an instance.
I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. - Jason ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Enumerating properties from outside an instance.
Pretend you're a mechanic and somebody calls you up and says the following: My car starts when it's in my driveway, but it doesn't start when I'm at the store. What's wrong with my car? Would you be able to help? Show us your code or we can't help you. :) -Steven -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Lutes Sent: Thursday, April 05, 2007 2:11 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Enumerating properties from outside an instance. I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] Enumerating properties from outside an instance.
You can do it; you must have an error in your code. for (var prop:String in clip) { var subObject:Object = clip[prop]; for (var otherProp:String in subObject) { trace(otherProp + : + subObject[otherProp]); } } It should look like that, but not horrible. From: Jason Lutes [EMAIL PROTECTED] Date: 2007/04/05 Thu PM 04:10:48 CDT To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Enumerating properties from outside an instance. I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. - Jason ___ Flashcoders@chattyfig.figleaf.com 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 -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Enumerating properties from outside an instance.
Thanks John, My loop is even simpler. I failed to mention that I need to examine nested MovieClip instances for functions. Variables seem to appear as expected, but functions only appear for the current scope. Very strange. Works as expected: for (var propertyIdentifier:String in this) { trace(propertyIdentifier); } Does not work as expected: for (var propertyIdentifier:String in this.someNestedInstance) { trace(propertyIdentifier); } - Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mark Hawley Sent: Thursday, April 05, 2007 3:54 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Enumerating properties from outside an instance. You can do it; you must have an error in your code. for (var prop:String in clip) { var subObject:Object = clip[prop]; for (var otherProp:String in subObject) { trace(otherProp + : + subObject[otherProp]); } } It should look like that, but not horrible. From: Jason Lutes [EMAIL PROTECTED] Date: 2007/04/05 Thu PM 04:10:48 CDT To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Enumerating properties from outside an instance. I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. - Jason ___ Flashcoders@chattyfig.figleaf.com 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 -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Enumerating properties from outside an instance.
If you're looking to iterate through a nested object(s), then you have to create a nested loop: function loopMe(target:Object):Void { trace('-- looping through: ' + target + '--'); for (var s:String in target) { trace(s + ': ' + target[s]); for (var t:String in target) { trace('\t' + t + ': ' + target[s][t]); } } } loopMe(myMC); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Lutes Sent: Thursday, April 05, 2007 3:09 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Enumerating properties from outside an instance. Thanks John, My loop is even simpler. I failed to mention that I need to examine nested MovieClip instances for functions. Variables seem to appear as expected, but functions only appear for the current scope. Very strange. Works as expected: for (var propertyIdentifier:String in this) { trace(propertyIdentifier); } Does not work as expected: for (var propertyIdentifier:String in this.someNestedInstance) { trace(propertyIdentifier); } - Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mark Hawley Sent: Thursday, April 05, 2007 3:54 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Enumerating properties from outside an instance. You can do it; you must have an error in your code. for (var prop:String in clip) { var subObject:Object = clip[prop]; for (var otherProp:String in subObject) { trace(otherProp + : + subObject[otherProp]); } } It should look like that, but not horrible. From: Jason Lutes [EMAIL PROTECTED] Date: 2007/04/05 Thu PM 04:10:48 CDT To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Enumerating properties from outside an instance. I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. - Jason ___ Flashcoders@chattyfig.figleaf.com 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 -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Enumerating properties from outside an instance.
function loopThrough(mc:MovieClip):Void { for (var a:String in mc) { trace(a + : + mc[a]); if (mc[a] typeof movieclip) loopThrough(mc[a]); } } You can use recursion and hope that you don't end up with circular references. ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] Enumerating properties from outside an instance.
Hello :) Your object is a primitive object ? or a object with custom instance inside ? Do you use AS2 classes in your code ? Try the ASSetPropFlags global function to destroy the protection of the object : var ref = this.someNestedInstance ; trace( + ref) ; _global.ASSetPropFlags( ref , null, 0, 1) ; for (var property:String in ref) { trace(property) ; } You can test the attribute of the properties of your object with my class Attribute : http://svn.riaforge.org/vegas/AS2/trunk/src/vegas/util/Attribute.as To install my framework (VEGAS ) : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN EKA+ :) 2007/4/6, David Ngo [EMAIL PROTECTED]: If you're looking to iterate through a nested object(s), then you have to create a nested loop: function loopMe(target:Object):Void { trace('-- looping through: ' + target + '--'); for (var s:String in target) { trace(s + ': ' + target[s]); for (var t:String in target) { trace('\t' + t + ': ' + target[s][t]); } } } loopMe(myMC); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Lutes Sent: Thursday, April 05, 2007 3:09 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Enumerating properties from outside an instance. Thanks John, My loop is even simpler. I failed to mention that I need to examine nested MovieClip instances for functions. Variables seem to appear as expected, but functions only appear for the current scope. Very strange. Works as expected: for (var propertyIdentifier:String in this) { trace(propertyIdentifier); } Does not work as expected: for (var propertyIdentifier:String in this.someNestedInstance) { trace(propertyIdentifier); } - Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mark Hawley Sent: Thursday, April 05, 2007 3:54 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Enumerating properties from outside an instance. You can do it; you must have an error in your code. for (var prop:String in clip) { var subObject:Object = clip[prop]; for (var otherProp:String in subObject) { trace(otherProp + : + subObject[otherProp]); } } It should look like that, but not horrible. From: Jason Lutes [EMAIL PROTECTED] Date: 2007/04/05 Thu PM 04:10:48 CDT To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Enumerating properties from outside an instance. I can't figure this out. I can set up a for...in loop to show me all the (enumerable) properties -- variables and functions -- on the MovieClip instance where I place the loop, but I can't enumerate properties for other (nested) MovieClip instances by simply changing the focus object of that same for...in loop. Why not? If I move the enumerating loop into the nested clips it works as expected. - Jason ___ Flashcoders@chattyfig.figleaf.com 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 -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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