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 ......
10 个FLex MVC框架
AdobeFlex及相关技术正成为RIA领域的主流。虽然Flex社区的规模还远比不上Java或Microsoft平台,但它正在FlexRIA开发者们的栽培下稳健地成长。许多开源开发框架也因此被创造出来:
Cairngorm(下载)
Cairngorm是最老也最成熟的Flex框架。它现在由Adobe拥有并开源,而且被Adobe的RIA顾问服 ......
因为无论是FLEX,还是Silverlight、AJAX,他们都无法直接操作数据库(据最新消息,微软有了Microsoft .NET RIA Services,它可以直接操作数据库,我期待着她能在VS2010中出现),通常用WEBSERVICE等中间人的方式来进行SOAP协议的的文本传输,效率很低(大家试一下就会知道简直无法忍受),FLEX为了加快传输速度,于是制定了 ......
<?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 ......
这一次的Flex 实践将要实现以下功能:
1、自定义一个简单的 Flex 组件
2、创建一个Index. mxml 来调用该组件
1)用 as 调用组件
&nbs ......