Re: [Flashcoders] trace all properties of a class recursively
I normally end up writing a toString function for all classes that I write so that I can at any point know what state the class is in. 2008/6/27 Patrick Matte | BLITZ <[EMAIL PROTECTED]>: > Yeah but describe type won't loop through the tree in a recursive manner. > > So I ended up writing a typed recursive function that will recursively trace > each object in the tree. It works fine. > >public static function recurse(page:Page, level:Number = > 0):void { >var string:String = ""; >for (var j = 0; j < level; j++) { >string = string + " "; >} >trace(string + page); >level++; >for (var i in page.pages) { >recurse(page.pages[i], level); >} >} > /* > Outputs > [Page id=Nav] > [Page id=Green1] >[Page id=Green2] > [Page id=Green3] >[Page id=Green4] > [Page id=Red1] >[Page id=Red2] > [Page id=Red3] >[Page id=Red4] > */ > > BLITZ | Patrick Matte - 310-551-0200 x214 > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wagner Amaral > Sent: Thursday, June 26, 2008 12:15 PM > To: Flash Coders List > Subject: Re: [Flashcoders] trace all properties of a class recursively > > You may want to take a look at flash.utils.describeType() > http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#describeType() > > > On Thu, Jun 26, 2008 at 3:43 PM, Patrick Matte | BLITZ < > [EMAIL PROTECTED]> wrote: > >> Is it possible to trace all the properties of a class with AS3? I kwow it >> works on dynamic properties on Object or Array... >> >> My class is like a tree and I want to see if the tree is built correctly. >> >> ___ >> 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 > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Random Lines 3D My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] trace all properties of a class recursively
Yeah but describe type won't loop through the tree in a recursive manner. So I ended up writing a typed recursive function that will recursively trace each object in the tree. It works fine. public static function recurse(page:Page, level:Number = 0):void { var string:String = ""; for (var j = 0; j < level; j++) { string = string + " "; } trace(string + page); level++; for (var i in page.pages) { recurse(page.pages[i], level); } } /* Outputs [Page id=Nav] [Page id=Green1] [Page id=Green2] [Page id=Green3] [Page id=Green4] [Page id=Red1] [Page id=Red2] [Page id=Red3] [Page id=Red4] */ BLITZ | Patrick Matte - 310-551-0200 x214 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wagner Amaral Sent: Thursday, June 26, 2008 12:15 PM To: Flash Coders List Subject: Re: [Flashcoders] trace all properties of a class recursively You may want to take a look at flash.utils.describeType() http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#describeType() On Thu, Jun 26, 2008 at 3:43 PM, Patrick Matte | BLITZ < [EMAIL PROTECTED]> wrote: > Is it possible to trace all the properties of a class with AS3? I kwow it > works on dynamic properties on Object or Array... > > My class is like a tree and I want to see if the tree is built correctly. > > ___ > 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] trace all properties of a class recursively
You may want to take a look at flash.utils.describeType() http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#describeType() On Thu, Jun 26, 2008 at 3:43 PM, Patrick Matte | BLITZ < [EMAIL PROTECTED]> wrote: > Is it possible to trace all the properties of a class with AS3? I kwow it > works on dynamic properties on Object or Array... > > My class is like a tree and I want to see if the tree is built correctly. > > ___ > 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