Flex——命令管理,Undo来Redo去
前言
Undo,Redo是编辑环境里常见的并且非常重要的功能,下面介绍【命令模式】在Flex/AS3下的实现。
ICommand接口
定义ICommand接口,其中Execute和UnExecute是相反的2个操作,Title属性用于命令显示,例如显示在操作历史列表里。
package cwn.wb.ui.core.command
{
import cwn.core.IDispose;
public
interface ICommand extends IDispose
{
function
get Title():String
function Execute():void
function UnExecute():void
}
}
CommandBase基类
CommandBase类主要实现ICommand接口,所有Command类都将继承CommandBase类。
package cwn.wb.ui.core.command
{
import cwn.core.IDispose;
public
class CommandBase implements ICommand
{
public
function CommandBase()
{
}
//===================ICommand========================
protected
var _Title:String;
public
function
get Title():String
{
return _Title;
}
public
function Execute():void
{
throw
new Error("Not implementation.");
}
pub
相关文档:
Top 10 things new Flex developers should know
By Michael Portuesi | Published: November 27, 2009
While helping a coworker get started with Flash and Flex development, I thought it would be a good time to cover the list of things that I have found pretty essential to know about Flex development, co ......
//获得屏幕的分辨率
var x:Number=Capabilities.screenResolutionX;
var y:Number=Capabilities.screenResolutionY;
Alert.show("x="+x+"y="+y);
第二种方法
Alert.show(stage.fullScreenWidth+"=="+stage.fullScreenHeight);
//获得stage(工作区)的宽、高
Alert.show(stage.stageWidth+"=="+stage.stageHei ......
Flex中的本地共享对象--SharedObject
本地共享对象有时被称作“Flash Cookie”,它是一个数据文件,可以由所访问的站点在您的计算机上创建。在Flash中提供了下面的操作本地对象的方法:
SharedObject.clear() 删除本地共享对象;
SharedObject.flush() 立即把共享对象数据写入本地文件;
SharedObject.getLoc ......
commpent
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()" backgroundDisabledColor="#EEC6C6"
bord ......