flex java整合小试身手

flex mxml代码如下:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   width="657" height="278" minWidth="955" minHeight="600">
	
	<fx:Script>
		<![CDATA[
			import mx.rpc.events.ResultEvent;
			protected function button1_clickHandler(event:MouseEvent):void
			{
				obj.sayHello(text.text);
				
			}
			
			protected function method1_resultHandler(event:ResultEvent):void
			{
				result.text=event.result as String;
				
			}
			
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<s:RemoteObject id="obj" destination="product"   endpoint="/helloWorld/messagebroker/amf">
			<s:method name="sayHello" result="method1_resultHandler(event)">
				
			</s:method>	
		</s:RemoteObject>
	</fx:Declarations>
	<fx:Style>
		#result{
			fontSize:22; 
			fontWeight:bold; 
			fontFamily:"宋体";
			color:#00e3e3;
		}
	</fx:Style>
	<s:Button x="140" y="135" label="获取结果" click="button1_clickHandler(event)"/>
	<s:Label id="result" x="285" y="68" width="235" height="36" backgroundAlpha="0.73"/>
	<s:TextInput id="text" x="122" y="73"/>
	<s:Label x="34" y="73" height="21" text="请输入您的姓名"/>
	
</s:Application>


/helloWorld/WebContent/WEB-INF/flex/remoting-config.xml的内容如下:

<?xml version="1.0" encoding="UTF-8"?> <service id="remoting-service" class="flex.messaging.services.RemotingService">

 <adapters>   <adapter-definition id="java-object"    class="flex.messaging.services.remoting.adapters.JavaAdapter"    default="true" />  </adapters>

 <default-channels>   <channel ref="my-amf" />  </default-channels>  <destination id="product"><!-- 和<s:RemoteObject id="obj" destination="product“对应 -->   <properties>    <source>com.test.Product</source>   </properties>  </destination> </service>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值