FocusManager
| Kind of class: | class |
|---|---|
| Inherits from: | Dispatcher |
| Author: | Martijn de Visser |
| Classpath: | org.asapframework.management.focus.FocusManager |
| File last modified: | Monday, 06 November 2006, 08:09:15 |
Class to manage focus between various UI elements, without the need of MM's focus manager (which requires elements to be derived from UIComponent class).
Listens to TAB key for forward navigation and SHIFT-TAB for backward navigation.Events broadcast to listeners:
org.asapframework.management.focus.FocusEvent with type:
FocusEvent with type:
ON_CHANGE_FOCUS Triggered when the focus of one of the registered elements changes.FocusEvent with type:
ON_CHANGE_FOCUS Usage:
You may need to add the 'SeamlessTabbing' parameter to the
<object> tag. From Macromedia: (http://www.macromedia.com/support/documentation/en/flashplayer/7/releasenotes.html#Fixes) The default value is true; set this parameter to false to disable "seamless tabbing", which allows users to use the Tab key to move keyboard focus out of a Flash movie and into the surrounding HTML (or the browser, if there is nothing focusable in the HTML following the Flash movie). ActiveX Flash Player has supported seamless tabbing since version 7.0.14.0.Summary
Constructor
Instance methods
Event handlers
Constructor
FocusManager
function FocusManager (
inListener:Object)
Constructor. IMPORTANT: when using FocusManager in a MovieClip, the manager will remain in memory (and active) when the clip is removed (due to listening to Key object). Use kill to remove the listener.
Parameters:
listener:
object (optional) which will receive events.
Usage:
The following code makes the object that instantiates the FocusManager the default listener. It will receive the onChangeFocus event.
var myFocus:FocusManager = new FocusManager(); myFocus.addEventListener(FocusEvent.ON_CHANGE_FOCUS, EventDelegate.create(this, onChangeFocus));
The following code makes the object that instantiates the FocusManager the default listener. It will receive the onChangeFocus event.
Instance methods
addElement
function addElement (
inElement:IFocus,
inPosition:Number) : Boolean
Set the TAB index for an interface element.
Parameters:
inElement :
Must implement the IFocus interface.
inPosition:
zero-based, optional. If ommitted, it will be added to the end of the list. If an element was already found at the position specifed, it will be inserted.
Returns:
Boolean indicating if addition was successfull.
Usage:
formFocus.addElement(to_name, 0); formFocus.addElement(to_email, 1); formFocus.addElement(to_city, 2);
clear
function clear (
) : Void
Clears list of focus elements
getElements
function getElements (
) : Array
Returns:
List of all elements managed by this FocusManager
kill
function kill (
) : Void
Kills the link to the Key object so the FocusManager can be removed by garbage collection. Best used in onUnload event of MC where FocusManager is instantiated in.
setFocus
function setFocus (
inElement:IFocus) : Void
Sets the focus to a specific element.
Parameters:
inElement:
Must implement the IFocus interface.
Usage:
var formFocus:FocusManager = new FocusManager(); formFocus.addElement(to_name, 0); formFocus.addElement(to_email, 1); formFocus.setFocus(to_name);
toString
function toString (
) : String
Event handlers
onKeyUp
function onKeyUp (
) : Void
Listens to SHIFT / TAB key.