第一个flex程序HelloWorld

走了不少弯路,通过上网查找写了自己的第一个helloworld程序

1.新建一个web工程,然后在WebContent或WebRoot上点右键, -->import-->file syste 选择解压后的blazeds的路径,写第一个Helloworld类,在remoting-config.xml中配置<destination id="hello">
<properties>
<source>com.flex.hello.HelloWorld</source>
</properties>
</destination>
部署工程并运行tomcat

2.新建flex project, 如图一,图二

3 编写flex代码
import mx.rpc.remoting.mxml.RemoteObject;
public function submit():void{
var re:RemoteObject=new RemoteObject();
re.destination="hello";
re.getHello();
re.addEventListener(FaultEvent.FAULT,fault);
re.addEventListener(ResultEvent.RESULT,result);
}
public function fault(event:FaultEvent):void{
Alert.show(event.fault.toString());
}

public function result(event:ResultEvent):void{
var ss:String=event.result as String;
Alert.show(ss);
}
或者
<mx:RemoteObject id="re" destination="hello" fault="faultevent)" [align=center]result="result(event)">[/align]
</mx:RemoteObject>
<mx:Button id="aa" label="确定" click="re.getHello()">

4.运行flex工程
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值