Flex与后台交互的4种方法
一、HTTPService
程序代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initializeHandler(event)">
<mx:Script>
<!--[CDATA[
private function initializeHandler(event:Event):void {
countriesService.send();
}
private function changeHandler(event:Event):void {
statesService.send();
}
]]>
</mx:Script>
<!-- 载入纯静态的xml数据 -->
<mx:HTTPService id="countriesService" url="http://www.rightactionscript.com/states/xml/countries.xml" />
<!-- 载入由php生成的xml数据 -->
<mx:HTTPService id="statesService" url="http://www.rightactionscript.com/states/xml/states.php">
<!-- 以下标签就是要发送到服务端的数据了,可以这样理解:有一个名为country的变量,它的值为花括号{}里的内容 -->
<mx:request>
<country>{country.value}</country>
</mx:request>
</mx:HTTPService>
<mx:VBox>
<!-- 此控件的数据由第一个<mx:HTTPService/>控件接收的内容提供,并且由这个ComboBox控制着第二个ComboBox所要显示的内容 -->
<mx:ComboBox id="country" dataProvider="{countriesService.lastResult.countries.country}"
change="changeHandler(event)" />
<!-- 下面的ComboBox已经绑定了{statesService.lastResult.states.state},随它的数据改变而改变 -->
<mx:ComboBox dataProvider="{statesService.lastResult.states.state}" />
</mx:VBox>
</mx:Application>
二、URLLoader
程序代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initializeHandler(event)">
<mx:Script>
<!--[CDATA[
private var _countriesService:URLLoader;
private var _statesService:URLLoader;
private function initializeHandler(event:Event):void {
_countriesService = new URLLoader();
_countriesService.addEventListener(Event.COMPLETE, countriesCompleteHandler);
_countriesService.load(new URLRequest("http://www.rightactionsc
相关文档:
http://www.belgacomtv.be/
http://www.xsteel.net/
http://veryhw.com/
http://www.redlei.com/test/redlei/
[url]http://www.cssflex.com/[/url]
[url]http://www.millionclouds.com/[/url]
[url]http://www.anywhere.fm/player/[/url]
[url]http://youyee.org/viewpoint/[/url]
[url]http://flexbox.mrinalwadhw ......
(转)java与flex通信
一、准备:
服务端:JDK1.5 (这个不用介绍了吧?)
服务端IDE:eclipse (它的主页)
客户端:FLEX 3 (Adobe® Flex® 3 是用于构建和维护在所有主要浏览器、桌面和操作系统一致地部署的极具表现力的 Web 应用程序的高效率的开放源码框架。)
客户端IDE:Flex Builder 3 ......
在项目中自定义一个CheckboxGroup,这个控件里面包含多个Checkbox想控制Checkbox的行为:所以使用查找一下帮助使用flex中经典方法:getDefinitionByName 函数的使用
public function getDefinitionByName(name:String):Object
返回参数 name 中指定的类引用
参数 name:String - 类名称
返回 Object - 返回参数 name 中 ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="vertical" creationComplete="initApp()">
<mx:states>
<!--新建“index”State-->
<m ......
转自:http://blog.csdn.net/meteorlWJ/archive/2008/03/27/2223239.aspx
这一次的Flex 实践将要实现以下功能:
1、自定义一个简单的 Flex 组件
2、创建一个Index. mxml 来调用该组件
&n ......