1 Reply Latest reply on Oct 30, 2009 12:14 AM by ppk luk

    Flex-Ajax Bridge: question about passing object of diff data types

    ppk luk Level 1

      Dear all,


        i am working with the Flex-Ajax bridge, i have some question and hope you can help:


        1. with FB3, when i use the 'create ajax bridge' feature to the required files, there will be:


            a) one .swf created for each .mxml,


            b) one .swf plus one .mxml (XXXHelper.mxml) created for each .as class


            c) one .js for each .as class/mxml


           so, my main.html (supposed to communicate with the flex) is required to included all the .swf and .js?? (long load time + more memory?)


           it is clumsy and difficult to managed if my javascript use several .as class or .mxml......
           is it possible to generate only 1 .swf + 1 .js?


        2. according to the document (http://livedocs.adobe.com/flex/3/html/help.html?content=ajaxbridge_3.html), it is ok to pass anonymous object
           (non-primitive) from actionscript to javascript, but i can't do so in the following code:
           this actionscript funciton definition don't work
           public function getRowData(rowNumber:int):Object{
               //in javascript, null is returned        
               return {row: rowNumber, text: "testing"};    
               //this don't work too
               var bb:Object = new Object();
               bb.row = "123";
               return bb;        
           but the following works (i don't know why), i can get an object
           in the javacript.
           public function getRowData(rowNumber:int):Object{
               var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(false);
              return decoder.decodeXML(new XMLDocument(xmlString));       
           the result of the above code is confusing...
           do flex-ajax bridge really support anonymous object???
           or how
           btw, Boolean seems no consider as 'primitive' data type too, so i can't pass Boolean object across javascript and actionscript???
           *** i am using Flex SDK 3.2,  FB3 and firefox 3.5
           thank you.
      ppk luk