Flex中使用currentStateChange事件监听State变化

Categories: Flex; Tagged with: ; @ October 9th, 2010 0:12

StateChangeEvent.CURRENT_STATE_CHANGE(currentStateChange):
StateChangeEvent 类代表当组件的 currentState 属性更改时调度的事件。

中文API: http://www.adobe.com/livedocs/flex/3_cn/mx/events/StateChangeEvent.html

使用方法:

1. ActionScript中监听Event

ui.addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, onCurrentStateChange);

注意: 如果用在主程序Application creationComplete的响应方法中, 可能无法监听首个StateChange事件(进入初始State);

2. MXML中监听Event

currentStateChange="onCurrentStateChange(event)"

附录: 响应函数

/** On State Change . */
protected function onCurrentStateChange(event:StateChangeEvent):void {
	printLog("LastState: " + event.oldState + "; currentState" + currentState);
}

Trace信息:

LastState: StateEmployeesList; currentStateStateDeptMgt

Flex4 State itemCreationPolicy 设定State组件立即创建

Categories: Flex; Tagged with: ; @ October 7th, 2010 22:20

没怎么用过State, 据说Flex4中State有很大更新, 今天小用了下. 发现一个问题:

非Start State中的Component在Application Create complete后不能立即使用. 于是想到了之前常用的creationPolicy – 统统设置为ALL, 结果仍旧无济于事.

解决方法: 设定组件itemCreationPolicy="immediate".

(more…)

字符串连续空格处理 – 在线小工具(使用Flex与正则表达式创建)

Categories: Flex; Tagged with: ; @ October 3rd, 2010 22:05

功能: 将会替换所有的(连续)空格为”,”
原理: Flex中使用RegExp替换. (more…)

FREE ebook – Getting started with Adobe Flex (From IBM DB2) Flex快速入门

Categories: Flex; Tagged with: ; @ October 2nd, 2010 23:28

Getting started with Adobe® Flex® couldn’t be easier. Read this free ebook to:

  • Understand how to build rich internet applications using Flex
  • Learn how to work with Flex Builder to create, run and debug Flex applications
  • Understand how Flex works with Web services and databases like DB2®
  • Learn about the Flex programming basics using MXML® and ActionScript(TM)
  • Get up to speed with powerful features like data binding, view states, and charting
  • Practice with hands-on exercises

DB2社区的免费电子书 – Flex快速上手, 尚无中文版.

Go–> https://www.ibm.com/developerworks/wikis/display/db2oncampus/FREE+ebook+-+Getting+started+with+Adobe+Flex

更多DB2社区的免费电子书:  ibm.com/db2/books

Flex 诡异错误Access of possibly undefined property…

Categories: Flex; Tagged with: ; @ September 17th, 2010 21:34

今天Debug碰到一个诡异的问题.

跑的好好的程序, 一Build就报错.  而且报错位置一直在Application的某一行, 雷打不动. 开始怀疑Build时动了Application, 增加了一个莫名其妙的字符什么的. 后来仔细排查, 原来是Application的Config xml文件中, 在Build时增加了一个{something}的字符.

估计是Flex当做这是一个Bindable的属性来处理了, 于是这行就是有错, 所以报错位置一直不变.

但MXMLC太不厚道了, 错误位置报的很清楚, 但错误文件只是写明了Application, 但问题是却是在Config xml中.

我顶你个肺.

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.