Hello,
I’m trying to convert to Actionscript 3.0 and I’m trying to find out how to loop through Stage objects as well as DisplayObject.
With AS 2.0 - I would only have to do:
for(var i in _root) // or MovieClip, this, ect
{
trace("i: " + i + " *: " + _root.*);
}
In AS 3.0 I found this equivalent which works w/ some objects:
public function debug_object(o:Object, show_all:Boolean):void
{
import flash.utils.*;
var def:XML = describeType(o);
var props:XMLList = def…variable.@name;
if(show_all) props += def…accessor.@name;
for each (var prop:String in props)
{
trace(prop + ": " + o[prop]);
}
}
this.showChildren(Stage);
This kind of works but the o[prop] always traces undefined and it's not showing any movieClips on the stage.
I would like to be able to have the debug object function be able to take Stage and DisplayObject arguments like such:
this.debug_object(Stage, true);
this.debug_object(flash.display.DisplayObject, true);
Any ideas on how I could achieve this?
Thanks,
Clem C