flex Bindable使用讲解
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx:Panel width="392" height="300" layout="absolute">
<mx:Label x="19" y="10" text="{user}" width="171" height="20"/>
<mx:Button x="216" y="8" label="测试Bindable" click="bind()" width="105"/>
<mx:DataGrid x="19" y="58" dataProvider="{arr}">
<mx:columns>
<mx:DataGridColumn headerText="year" dataField="year"/>
<mx:DataGridColumn headerText="city" dataField="city"/>
<mx:DataGridColumn headerText="provice" dataField="provice"/>
<mx:DataGridColumn headerText="total" dataField="total"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var user:String="HELLO";
[Bindable]
private var arr:ArrayCollection=new ArrayCollection([
{year:2009,city:"Shanghai",provice:"上海",total:580000},
{year:2009,city:"Beijing",provice:"河北省",total:7852020},
{year:2009,city:"Nanjing",provice:"江苏省",total:895145},
{year:2009,city:"Hangzhou",provice:"浙江省",total:4132415}]);
//修改了绑定的user和arr,并没有修改label和datagrid
private function bind():void{
this.user="HEllo22";
arr.removeItemAt(3);
}
]]>
</mx:Script>
</mx:Application>
相关文档:
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
......
对于习惯了使用桌面应用程序的用户而言,回车后下移焦点到下一个编辑组件中的小功能,是非常贴心的,利用flex中的KEY_DOWN事件可以方便的实现回车下移焦点,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplet ......
最近在项目中遇到flex跨域访问的安全沙箱问题,查资料了解到需要在服务端加上crossdomain.xml文件,即:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-do ......
利用Socket实现C++与Flex通信
一、C++服务器端
(用的是Visual Studio 2008(05,03的应该也可以,VC++的可能需要稍微改动))
代码如下:
#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
#pragma comment(lib,"ws2_32.lib ......
三年前,用过AmfPHP与Flash/Flex
Remoting做过交互,最近接触Python,公司项目用的Flex做前端,所以接触了PyAmf。PyAmf本质上跟AmfPHP是雷同的。都是通
过对AMF协议(ActionScript Message Format)协议的支持来实现对Flash的交互过程。
一、首先,简单的介绍一下AMF协议格式。
AMF是Adobe独家开发出来的通信协议,它采 ......