12 thoughts

  1. Shigeru, that can happen when attempting to use ObjectUtil.toString() on complex objects or on some core classes. I haven’t tried to find a pattern among the different cases we’ve seen. Does anyone know if certain methods or class definitions cause that ObjectUtil method to crash?

  2. Bug submitted.
    I created a FlexDump component during some free time today. It’s really basic, but works, and I’ll send it along to whomever wants to test it more.

  3. Here is one I use as well, error is a textarea. Simply send in the object you wish to see expanded. I tried doing this recursively as well, but objects have circular references at times.
    You can change this to use trace as well.
    function showme(o) {
    error.text = error.text + "**************************" + "r";
    for (var prop in o) {
    error.text = error.text + "prop: " + prop + " value: " + o[prop] + "r";
    }
    error.text = error.text + "**************************" + "r";
    }

  4. Another technique I have used is to save the error to a file using cfdocument, then load it with getURL from FlexBuilder.
    <cfset reportdir = getdirectoryfrompath(getbasetemplatepath())>
    <cfdocument filename="#reportdir#test.swf" format="flashpaper" overwrite="yes" >
    <cfoutput>
    Incoming parms:<br />
    <cfdump var="#form#">
    Error occurred at #now()#<br />
    <cfdump var="#cfcatch#">
    </cfoutput>
    </cfdocument>

  5. I may be stupid.
    I tried to dump Loder’s Complete Event Object.
    And the Loder component load SWF.
    it must be huge…
    it’s like below.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml&quot; xmlns="*" layout="absolute">
    <mx:Script>
    <![CDATA[
    private function loadComponent():void
    {
    swfLd.source = "./swfComponent01.swf";
    }
    private function loadCompetedEvent(evt:Event):void
    {
    txtDump.text = mx.utils.ObjectUtil.toString(evt);
    }
    ]]>
    </mx:Script>
    <mx:Button x="10" y="10" label="Load" click="loadComponent()"/>
    <!– <mx:Loader id="swfLd" x="10" y="42" complete="loadCompetedEvent(event)" /> –>
    <mx:Loader id="swfLd" x="10" y="42" source="./swfComponent01.swf" complete="loadCompetedEvent(event)" />
    <mx:TextArea id="txtDump" x="10" y="290" width="610" height="360"/>
    </mx:Application>
    If Loader load SWF on clicking button, InternetExplorer didn’t shutdown and FlashPlayer output runtime error like below.
    StackOverflowError: Error #1023: Stack overflow.
    at mx.utils::ObjectUtil$/getClassInfo()

    But Loader load SWF on loading, InternetExplorer shutdowned.

  6. Shigeru,
    Again, the problem is the complex class objects that are being output. Since there will be a target property which will be a class object and also the bubbling ‘effect’, ObjectUtil.toString() takes much longer than the VM is willing to wait.

  7. Here’s the FlexDump component:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TextArea xmlns:mx="http://www.macromedia.com/2005/mxml&quot; xmlns="*">
    <mx:Script>
    <![CDATA[
    import mx.utils.ObjectUtil;
    private var _dump:Object;
    private var _dumpString:String = ”;
    function get dump():String
    {
    return _dumpString;
    }
    public function set dump(value:Object):void
    {
    _dump = value;
    setDump(value);
    }
    private function setDump(newDump:Object):void
    {
    //trace(newDump);
    _dumpString = ObjectUtil.toString(newDump);
    //trace(_dumpString);
    this.text = _dumpString;
    }
    ]]>
    </mx:Script>
    </mx:TextArea>
    And here’s an example app:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml&quot; xmlns="*" layout="absolute">
    <mx:Array id="arr1" >
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    <mx:Object label="{Math.random()}" />
    </mx:Array>
    <FlexDump width="100%" height="100%" id="dump1" dump="{arr1}" />
    </mx:Application>

Leave a Reply