Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Thursday, July 31, 2008

Sample MXML

Thursday, July 31, 2008    0 Comments

Testing MXML support. Found this @ Shigeru Nakagaki (part of a post: AIR:How to use RemoteObject without compiler option.)
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication layout="vertical"
xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="init()">

<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;

private function init():void
{
//
}

private function resultHandler(e:ResultEvent):void
{
log.text = e.result.toString() + "\n" + log.text;
}

private function faultHandler(e:FaultEvent):void
{
Alert.show(e.fault.message);
}

private function sendMessage():void
{
// call CFC method with arguments
ro.echo(msg.text);

msg.text = "";
}

]]>
</mx:Script>

<mx:RemoteObject id="ro"
destination="ColdFusion"
endpoint="http://127.0.0.1/flex2gateway/"
source="AirRemoting.BlazeDSCFCTest3"
result="resultHandler(event)"
fault="faultHandler(event)" />

<mx:HBox>
<mx:TextInput id="msg" />
<mx:Button label="send" click="sendMessage()" />
</mx:HBox>

<mx:TextArea id="log" width="200" height="200" />


</mx:WindowedApplication>

Labels: ,