Hmm, on testing this code in your scenario I realized I can reproduce the issue again that you described. It seems related to ObjectProxy's use of the intrinsic Proxy class from ActionScript. If you could avoid checking for existing properties and develop another way to detect what needs to be an Array then you can avoid the bug... otherwise you will need to avoid the use of ObjectProxy in this scenario for now.
 
Note the bug that was filed was 188654 if you need to refer to it in the future.
 
Pete


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Farland
Sent: Wednesday, October 18, 2006 9:51 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Stack Overflow in swf to swf include

It does restrict some functionality... to describe what's happening in HTTPService - an underlying URLLoader returns your XML data as a String. This String is then turned into XML and then if the resultFormat is left as the default setting of "object" it will convert this XML into an ActionScript Object graph. If makeObjectsBindable is false then Objects will not be wrapped by mx.utils.ObjectProxy and Arrays will not be wrapped by mx.collections.ArrayCollection and as such property change events will not be dispatched when the object graph is modified, which will mean if the data is used as a data provider to a UI component it won't reflect changes as the data is modified.
 
Another workaround for now is to do the decoding yourself. You could either change the resultFormat attribute to E4X and then process the XML structure into a tree of objects or specify a Function for the xmlDecode property. Some code to demonstrate the general idea is below:
 
import mx.collections.ArrayCollection;
import mx.utils.ObjectProxy;
 
...
 
    private function decode(data:XML):Object
    {
        var result:Object;
 
        if (data.elements().length() == 0)
        {
            result = data.text().toXMLString();
        }
        else
        {
            result = {};
            result = new ObjectProxy(result);
            var elements:XMLList = data.elements();
 
            for each (var x:XML in elements)
            {
                var part:Object = decode(x);
 
                var name:String = x.localName();
                var existing:Object = result[name];
                if (existing != null)
                {
                    if (existing is ArrayCollection)
                        ArrayCollection(existing).addItem(part);
                    else
                    {
                        var temp:ArrayCollection = new ArrayCollection();
                        temp.addItem(existing);
                        temp.addItem(part);
                        result[name] = temp;
                    }
                }
                else
                {
                    result[name] = part;
                }
            }
        }
 
        return result;
    }


From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Flex Learner
Sent: Wednesday, October 18, 2006 2:25 AM
To: [EMAIL PROTECTED]ups.com
Subject: Re: [flexcoders] Stack Overflow in swf to swf include

Thanks Pete. Adding makeObjectsBinadble="false" solved the problem. Yes, the service returns a simple XML generated from a cfm file.
 <userPref>
   
   <device>phone
   
   </device>
 </userPref>
I'm curious  to know how this is related to the stack overflow. Does makeObjectsBinadble="false" restrict any functionality ? - since i need the included swf to communicate with the loader swf and also with the hosting HTML page (via some callback js fns).

-Joseph



 
On 10/18/06, Peter Farland <[EMAIL PROTECTED]com> wrote:

I could reproduce your problem - I'll log a bug on your behalf.
 
Out of curiosity, does your HTTPService return XML? If so, any chance you could show us what the XML looks like? As a work around for now you could either set makeObjectsBinadble="false" on your HTTPService tag or set resultFormat="e4x" or resultFormat="text" (instead of the default, which is "object").
 
Thanks,
    Pete
 


From: [EMAIL PROTECTED]ups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Flex Learner
Sent: Tuesday, October 17, 2006 2:45 PM
To: [EMAIL PROTECTED] ups.com
Subject: [flexcoders] Stack Overflow in swf to swf include

 

HI,
 
I'm trying to include an swf file (generated from FlexBuilder) within another swf file using <mx:image>. The included file is located on a different server, and the include works fine. Now, if a <HTTPService> is added to the included file, the call fails with the following exception.
 
Error: Error #1023: Stack overflow occurred.
 at Object$/Object::_hasOwnProperty()
 at Object/http://adobe.com/AS3/2006/builtin::hasOwnProperty()
 at Object$/Object::_hasOwnProperty()
.....  at Object$/Object::_hasOwnProperty() is repeated many times.....
 
It appears like an infinite loop that's triggered internally and terminates with a stack overflow.
 
The mxml for the caller swf (located on www.abc.com) is as follows :
==========================================

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml " layout="horizontal">
<mx:Script>
 <![CDATA[
import flash.system.Security;

Security.allowDomain("www.xyz.com");

 ]]>
 
</mx:Script>
<mx:Image source="http://www.xyz.com/test/Loadee.swf " x="300" y="350" showBusyCursor="true"/>
</mx:Application>

mxml for the called swf (Loadee.swf)

==============================

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml " layout="horizontal" width="270" height="54"  creationComplete=" getState.send();">
 <mx:Text text="Initial Text" x="300" y="300" id="thisText"/>
 <mx:HTTPService url=""http://www.xyz.com/ServersideScript.do" target=_blank>http://www.xyz.com/ServersideScript.do " id="getState" result="chgState()"/>
 
 <mx:Script>
  <![CDATA[
   function chgState() {
    // ideally do something with the HTTP response here,    
    thisText.text= "HTTP call succeeded";
   }
  ]]>
 </mx:Script>

</mx:Application>

Any inputs here will be greatly helpful.

Thanks,

Joseph


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to