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>
今天的文章flex java整合小试身手分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/27506.html