加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex java整合小试身手

发布时间:2020-12-15 04:11:56 所属栏目:百科 来源:网络整理
导读: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" mi

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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读