0 Replies Latest reply on Nov 4, 2010 9:59 AM by frenmanoj

    How to convert double array data from ActionScript to Java ?

    frenmanoj

      I need  to send a double array data from flex to java server via remote  object. There is no problem with sending the data to server. But, the  problem is how to retrieve the double array data in server. Based on  various articles, and resources from internet, it has been confirmed  that Arrays in actionscript are converted to java.util.List. But, i  actually didn't get the idea on how to get my original data back. 

      For instance, i have inserted my flex code as below. There, i need a code for java server to retrieve the data (named "myData").

       

      ======================================== 
      <?xml version="1.0" encoding="utf-8"?> 
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"  
               xmlns:s="library://ns.adobe.com/flex/spark"  
               xmlns:mx="library://ns.adobe.com/flex/mx"
       
           <fx:Declarations> 
              <mx:RemoteObject id="remoteObject" 
                               destination="javaServerClass"
                   
                  <mx:method name="functionName"  
                             result="resultHandler(event)"  
                             fault="faultHandler(event)" /> 
              </mx:RemoteObject> 
           
          </fx:Declarations> 
           
          <fx:Script> 
              <![CDATA[ 
                   
                  import mx.rpc.events.FaultEvent; 
                  import mx.rpc.events.ResultEvent; 
                   
                  protected function button_clickHandler(event:MouseEvent):void 
                  { 
                      var myData:Array = new Array(6); 
                      myData[0] = new Array(1,2,3); 
                      myData[1] = new Array(4,5,6); 
                      myData[2] = new Array(7,8,9); 
                      myData[3] = new Array(10,11,12); 
                      myData[4] = new Array(13,14,15); 
                      myData[5] = new Array(16,17,18); 
                       
                      remoteObject.functionName(myData); 
                  } 
                  private function resultHandler(event:ResultEvent):void  
                  { 
                      // some result handling codes (if any) 
                  } 
                  private function faultHandler(event:FaultEvent):void  
                  { 
                      // some fault handling codes (if any) 
                  } 
           
              ]]> 
          </fx:Script> 
           
          <s:Button  label="Send data" 
                         id="button" 
                         click="button_clickHandler(event)"  /> 
      </s:Group> 
      ======================================== 


      Your suggestions are generously appreciated.