Category Archives: ActionScript

ActionScript

Flex: Datagrid派发ITEM_EDIT_BEGIN后因fm/focusManager为Null报错的解决方法

某DataGrid 监听Editor_BEGIN事件, 如果有数据未保存切换界面时, 会弹出Alert, 在弹出Alert之后, 确定切换界面时, DataGrid报错: DataGrid的itemEditorItemEditBeginHandler方法中: var fm:IFocusManager

More…

Posted in ActionScript | Tagged , , , , | 1 Comment

Flex: HttpService正常返回Html, 但派发FaultEvent事件的解决方法

HttpService的默认resultFormat为”object” HTTPService.RESULT_FORMAT_OBJECT 在服务器响应后, AbstractOperatoin.processResult()会对响应进行初步处理,

if (resultFor

More…

Posted in ActionScript | Tagged , , , | Leave a comment

Flex:使用正则表达式替换String

需求: 通过某些字符串生成文件名称, 简单要求: 仅允许数字或字母及”_” 代码:

var regExp:RegExp = new RegExp(“[^A-Za-z0-9_]“, “g”); // 正则表达式, 将非字母数字或下划线的字符替换为”_”, 全部替换.
fi

More…

Posted in ActionScript | Tagged , , , | Leave a comment

Flex: 将Date输出为YYYYMMDDHHMMSS格式

/** 将给定的Date输出为YYYYMMDDHHMMSS格式, 如:20100115091809., */
public static function dateToString(date:Date):String {
if(date == null) {
return null;

More…

Posted in ActionScript | Tagged , , | Leave a comment

Flex SharedObject 使用举例

需求: 需要将某个UI上的几条输入项目存到SharedObject中, 每次Application关闭时进行存储, 开启Application时, 读取上次保存的值并set到ui上.
效果:
image
每次关闭前, 将会保存最后一次更改的数据; 每次开启前, 将读取上次保存的数据并set到ui上.
代码:

More…

Posted in ActionScript | Tagged , , | Leave a comment