Here give voGlobal class in this common function of closing popup
----------------------
package com.newVlaueObject.vo
{
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
public class voGlobal
{
private static var _instance:voGlobal;
public function voGlobal(enforce:SingletonEnforcer):void
{
}
public static function get instance():voGlobal
{
if(voGlobal._instance == null){
voGlobal._instance = new voGlobal(new SingletonEnforcer());
}
return voGlobal._instance;
}
public function titleWindow_keyDown(event:KeyboardEvent):void
{
if (event.charCode == Keyboard.ESCAPE) {
PopUpManager.removePopUp(event.currentTarget as IFlexDisplayObject);
}
}
}
}
class SingletonEnforcer{}
--------------------------------------------
In each Popup object give keydown Event and init event
KeyDown Event is
keyDown="{voGlobal.instance.titleWindow_keyDown(event)}"
In Init event you just focus any one component of popup object
like
txtName.setFocus();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment