Flex creationPolicy策略
在Flex中,利用state进行状态和页面的迁移与变换,中间的AddChild IOverride有一个creationPolicy,这个属性有三种设置,分别如下:
AUTO:默认设置,只有在状态改变的时候,即时的生成新增组件;
ALL:在Application加载的时候,就加载了新增的组件,在状态改变的时候显示;
NONE:需要手动的调用该addChild Instance createInstance方法生成新增组件,方能显示;
示例代码如下:
<?xml version="1.0"?>
<!-- states\StatesCreationPolicy.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initButton();">
<mx:Script>
<!--[CDATA[
// Because the cpAll view state creates the Button control
// at application startup, you can access the control to
// set the label before the first switch
// to the cpAll view state.
public function initButton():void {
newButton.label="cpAll Button";
}
]]-->
</mx:Script>
<mx:states>
<!-- Create the Button control at application startup. -->
<mx:State name="cpAll">
<mx:AddChild relativeTo="{myPanel}" creationPolicy="all">
<mx:Button id="newButton"/>
</mx:AddChild>
</mx:State>
<!-- Create the Button control when you want to create it. -->
<mx:State name="cpNone">
<mx:AddChild id="noCP"
relativeTo="{myPanel}" creationPolicy="none">
<mx:Button label="cpNone button"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Panel id="myPanel"
title="Static and dynamic states"
width="300" height="150">
<!-- Change to the cpAll view state. -->
<mx:Button label="Change to cpAll state"
click="currentState
相关文档:
2010.2.21 初步印象
1. Flex工程的核心就是那个mxml文件,所有的代码或结构都是围绕它;
2. 与这个mxml文件同名的as文件,他们之间的关系有点像html与js的关系,而且还不用include;
3. 最终会生成一个与mxml文件同名的html文件,而flash文件会被嵌入进去的;
2010.2.22 与Sping,Hibernate集成
看了这篇文章:http://w ......
sdk3.2 下会有此问题.
项目中想用moduleLoader加载模块,达到模块化开发的目的.但是出现了共享变量的问题:
TypeError: Error #1034: 强制转换类型失败:无法将 Object@406e651 转换为 mx.messaging.messages.IMessage。
代码+上// import mx.managers.PopUpManager;
// private var popUpManage ......
var formatter:DateFormatter = new DateFormatter();
formatter.formatString = "YYYY-MM-DD JJ:NN:SS";
Alert.show(formatter.format(new Date())); ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
public var pageRecordes:uint = 8;
public var totalPages:ui ......
过去在对DataGrid设置行背景色时,感觉还是挺方便的,只要重写DataGrid的,如下
private var _rowColorFunction:Function;
public function set rowColorFunction(f:Function):void
{
this._rowColorFunction = f;
}
public function get rowColorFunction():Func ......