第一副图截取该图片靠左上的500*65
第二幅图则将图片转换为500*65
Image的scaleContent默认为true,将其置为false, 则实现第一附图的效果.
private function setImgVisable(visable:Boolean, source:String=null):void { _imgBanner.visible = visable; if(visable) { _imgBanner.scaleContent = false; _imgBanner.explicitHeight = IMG_HEIGHT; _imgBanner.explicitWidth = IMG_WEIHT; _imgBanner.source = source; }else { _imgBanner.explicitHeight = 0; _imgBanner.explicitWidth = 0; _imgBanner.source = null; } }
可以通过设定Tree的样式来更改Tree的icon. 如下
_treeLAAndSub = new Tree(); _treeLAAndSub.iconField = "hahah@#$@#$"; _treeLAAndSub.setStyle("folderClosedIcon", ImagesForActions.iconImport); //文件夹关闭时 _treeLAAndSub.setStyle("folderOpenIcon", ImagesForActions.iconExport); //文件夹打开 _treeLAAndSub.setStyle("defaultLeafIcon", ImagesForActions.iconCopy); // 叶子 _treeLAAndSub.setStyle("disclosureOpenIcon", ImagesForActions.iconRemove); //文件夹打开时旁边的图示 _treeLAAndSub.setStyle("disclosureClosedIcon", ImagesForActions.iconAdd); //文件夹关闭时旁边的图示
The preferences here are generic to all debuggers, and govern stylistic and prompting options
Option |
Description |
Default |
---|---|---|
Reuse editor when displaying source code |
The debugger displays source code in an editor when stepping through an application. When this option is on, the debugger will reuse the editor that it opened to display source from different source files. This prevents the debugger from opening an excessive number of editors. When this option is off, the debugger will open a new editor for each source file that needs to be displayed. |
On |
Activate the workbench when when a breakpoint is hit | This option brings attention to the debugger when a breakpoint is encountered, by activating the associated window. The visual result varies from platform to platform. For example, on Windows, the associated window’s title bar will flash. | On |
Activate the debug view when a breakpoint is hit | This option brings attention to the debug view when a breakpoint is encountered. If the view is already open it will be activated. If the view is not already open it will be opened automatically. | On |
Skip breakpoints during a ‘Run to Line’ operation | This option controls whether breakpoints are ignored when performing a ‘Run to Line’ operation. When the option is on, the debugger does not suspend at breakpoints encountered when a ‘Run to Line’ operation is invoked. When the option is off, breakpoints behave normally. | Off |
Prompt for conformation when deleting all breakpoints | This option controls whether you will be prompted for confirmation when you try to delete all of your breakpoints | On |
Prompt for confirmation when deleting breakpoint containers | This option controls if you will be prompted for confirmation when you try to delete a breakpoint container, e.g. a breakpoint working set | On |
Changed value colour | This option allows you to change the colour of a changed value in the variables view, expressions view, memory view, anywhere running program variables are rendered | Red |
Changed value background colour | This option allows you to change the selection colour of a changed variable, e.g. in the variables view showing columns | Yellow |
Memory unbuffered colour | This option allows you to change the rendering colour of unbuffered memory blocks in the memory view | Grey |
Memory buffered colour | This option allows you to change the rendering colour of buffered memory blocks in the memory view | Black |
1 .基本使用:
private var op:AbstractOperation; public function loadEmployees():void { op = AppContext.getRemoteObject().getOperation("loadEmployees"); //获得Operation op.arguments = [id]; //设定参数 var at:AsyncToken = op.send(); //Send at.addResponder(this); //为本实例增加responder } //---------------------实现 IResponder------------------------------- public function result(responderResult:Object):void { var resultEvent:ResultEvent = responderResult as ResultEvent; var ac:ArrayCollection = resultEvent.result as ArrayCollection;//result为服务器返回的数据 log.debug("已读取到 " + this + "的职员列表, 职员数目为: " + ac.length); } public function fault(data:Object):void { throw new Error("远程操作失败"); }
2. 另外可通过外置Responder实例来响应结果, 同时在实例中dispatch Event, 可实现在当前类中响应服务器端返回数据.
//Listener - onButtonDelClicked private function onButtonDelClicked(e:MouseEvent):void { var op:AbstractOperation = AppContext.getRemoteObject().getOperation("delEmp"); log.info("Deleteing..."); op.arguments = [datagridEmpList.selectedItem as Employee]; var at:AsyncToken = op.send(); var rs:OperationResponder = new OperationResponder();//增加Responder实例 rs.addEventListener(OperationResultEvent.OPERATION_COMPLETE, onOperationSuccess);//监听由Responder派发的Custom Event at.addResponder(rs);//为AsyncToken增加Responder } //-----------------------on RemoteOperationSuccess - SaveNew - UPdate - Delete - load Department- 监听多个操作的Event----------------- private function onOperationSuccess(e:OperationResultEvent):void { var resultEvent:ResultEvent = e.resultData as ResultEvent; var resultEventATMessage:RemotingMessage = resultEvent.token.message as RemotingMessage; var operationName:String = resultEventATMessage.operation; if(operationName == "saveEmpToDB") {//新建保存 //.... }else if(operationName == "updateEmp"){ //更新 //.... } }else if(operationName == "delEmp") {//删除 var deletedEmp:Employee = resultEventATMessage.body[0]; log.info("已成功删除职员: " + deletedEmp.name); }else if(operationName == "loadDepartments") { //加载部门信息 //... } }
OperationResponder类:
package com.insprise.dept.view { /** * Select Departments Responder */ [Event(name = "OperationComplete", type="com.insprise.dept.event.OperationResultEvent")] public class OperationResponder extends EventDispatcher implements IResponder { public function OperationResponder() { super(); } public function result(data:Object):void { // var resultEvent:ResultEvent = data as ResultEvent; // var ac:ArrayCollection = resultEvent.result as ArrayCollection; dispatchEvent(new OperationResultEvent(data)); } public function fault(info:Object):void { throw new Error("服务器出错 - 调用服务器端方法失败" + ErrorMessage); } }//end of class }//end of package
OperationResultEvent类:
package com.insprise.dept.event { /** * when Operation Success, and it's responder can dispatch this event */ public class OperationResultEvent extends Event { public static const OPERATION_COMPLETE:String = "OperationComplete"; private var _resultData:Object; /** * Constructor */ public function OperationResultEvent(resultData_:Object) { super(OPERATION_COMPLETE, false, false); _resultData = resultData_; } /** * Getter */ public function get resultData():Object { return _resultData; } /** * Override - MUST */ override public function clone():Event { return new OperationResultEvent(_resultData); } /** * OPTIONAL */ override public function toString():String { return formatToString(OPERATION_COMPLETE, "_resultData"); } }//end of class }//end of package
3: ResultEvent常用操作:
ResultEvent由AsyncToken的applyResult方法派发, 将该Event传递至Responder的result方法中.
ResultEvent的属性:
/** * Creates a new ResultEvent. * @param type The event type; indicates the action that triggered the event. * @param bubbles Specifies whether the event can bubble up the display list hierarchy. * @param cancelable Specifies whether the behavior associated with the event can be prevented. * @param result Object that holds the actual result of the call. * @param token Token that represents the call to the method. Used in the asynchronous completion token pattern. * @param message Source Message of the result. */ public function ResultEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = true, result:Object = null, token:AsyncToken = null, message:IMessage = null) { super(type, bubbles, cancelable, token, message); if (message != null && message.headers != null) _statusCode = message.headers[AbstractMessage.STATUS_CODE_HEADER] as int; _result = result; }
resultEvent.result存放有当前op返回值, 可通过ObjectUtils.toString(resultEvent.result)来查看其类型及信息
其中token中存放有如下具体信息:
Message中的内容:
body中存放有当前Operation的很多参数, 可使用如下方法调用Message:
var resultEventATMessage:RemotingMessage = resultEvent.token.message as RemotingMessage;
然后可通过resultEventATMessage.operation / desination/body[*]等来调用op/destination名字及op的参数.
在Operation中定义了message的内容:
以下代码来自mx.rpc.remoting.Operaiton
override public function send(... args:Array):AsyncToken { if (!args || (args.length == 0 && this.arguments)) { if (this.arguments is Array) { args = this.arguments as Array; } else { args = []; for (var i:int = 0; i < argumentNames.length; ++i) { args[i] = this.arguments[argumentNames[i]]; } } } var message:RemotingMessage = new RemotingMessage(); message.operation = name; message.body = args; message.source = RemoteObject(service).source; return invoke(message); } }
mx_internal is a namespace used by the Flex framework to partition out functions and properties that may change in future releases of the Flex SDK.
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.