易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

Flex 时间格式化 (转换)

在Flex应用中常常需要以一定的格式来显示时间,以下是一种做法。
首先创建一个DateFormatter 控件
<mx:DateFormatter id="df" formatString="YYYY-MM-DD JJ:NN:SS"/>
formatString="YYYY-MM-DD JJ:NN:SS"指定了时间的格式为2009-6-20 19:02:27,这里可以设置成自己需要的格式。
然后写个函数
    ......

flex 获得当前日期

    var formatter:DateFormatter = new DateFormatter();
    formatter.formatString = "YYYY-MM-DD JJ:NN:SS";
    Alert.show(formatter.format(new Date())); ......

flex PopMenu(demo)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
     <mx:Script>
        <![CDATA[
       //导入 ......

Flex List行背景色

 过去在对DataGrid设置行背景色时,感觉还是挺方便的,只要重写DataGrid的,如下
private var _rowColorFunction:Function;
public function set rowColorFunction(f:Function):void
{
this._rowColorFunction = f;
}
public function get rowColorFunction():Func ......

FLex组件之滚动条(ScrollBar)CSS美化

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Style>
ScrollBar
{
    /*划动块图片皮肤*/
    thumbDownSkin: Embed(source="scrollBar/thumb. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号