header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Manoj
Points:40
Posts:0

11/4/2010 9:05:18 AM

Title: How to convert double array data from ActionScript to Java ?


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 (name "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.



1
Connor
Points: 0
Posts:0
11/4/2010 11:26:40 AM



I think you can run the for loop to recreate the subarrays on server from the string values stored in the main array.

2
Manoj
Points: 40
Posts:0
11/4/2010 12:40:14 PM




@Connor...

I'll be more grateful if you post a bit of sample codes...


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 5+1 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions