in Flex:
<mx:RemoteObject id="ro" destination="amfphpcode"source="DemoClass">
<mx:method name="setData" result="setDataResultHandler(event);" />
</mx:RemoteObject>
<mx:Text id="txt1" />
<mx:Text id="txt2" />
<mx:Text id="anstxt" text={ans} />
<mx:Button label=”Send Data” click=”btnClick( )” />
private function btnClick() : void
{
ro.setData(txt1.text , txt2.text);
}
private function setDataResultHandler(event:ResultEvent) : void
{
ans = event.result.toString();
}
in php: (http:\\localhost\amfphpcode\services\DemoClass.php)
class DemoClass
{
function setData($v1,$v2)
{
return ($v1+$v2);
}
}
I hope you will get your solution from this.
If not get, tell me.
________________________________
From: Scott <[email protected]>
To: [email protected]
Sent: Tuesday, 24 March, 2009 4:14:33 PM
Subject: RE: {Disarmed} [flexcoders] remoteobject and parameters
You need to create a remoteobject in Flex.
I use ColdFusion for my backend but it
should be similar. I’m also not sure if you’re using amfphp
or not but this is the basis to work from:
<mx:Script>
….
private function accessRemote( ):void
{
phpService.remotePH PFunctionName( variable1,
variable2, variable3 );
}
….
<mx:Remoteobject id=”phpService”
destination=”amfphp”/>
<mx:Method name=”remotePHPFunctionNa me”
result=”functionResultHandl er(event)” fault=”faultResultHandler( event)”
/>
</mx:Remoteobject>
<mx:Button label=”Remote Object”
id=”btnRemote” click=”accessRemote( )” />
________________________________
From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On
Behalf Of shrike6_7
Sent: Tuesday, March 24, 2009 5:40
AM
To: flexcod...@yahoogro ups.com
Subject: {Disarmed} [flexcoders]
remoteobject and parameters
Hello,
with a remoteobject how can I send parameters?
If I use:
<mx:method name="setData" >
<mx:arguments>
<arg1>{text1. text}</arg1>
<arg2>{text2. text}</arg2>
</mx:arguments>
</mx:method>
at serverside (php with amf) I have a function setData($arg1, $arg2)
but can I send this parameters in POST and receive it in the $_POST variable?
Thanks
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Add more friends to your messenger and enjoy! Go to
http://messenger.yahoo.com/invite/