Packagemx.managers
Classpublic class SystemManager
InheritanceSystemManager Inheritance flash.display.MovieClip
ImplementsIChildList, IFlexDisplayObject, IFlexModuleFactory, ISWFBridgeProvider, ISystemManager

The SystemManager class manages an application window. Every application that runs on the desktop or in a browser has an area where the visuals of the application are displayed. It may be a window in the operating system or an area within the browser. That area is an application window and different from an instance of mx.core.Application, which is the main, or top-level, window within an application.

Every application has a SystemManager. The SystemManager sends an event if the size of the application window changes (you cannot change it from within the application, but only through interaction with the operating system window or browser). It parents all displayable things within the application like the main mx.core.Application instance and all popups, tooltips, cursors, and so on. Any object parented by the SystemManager is considered to be a top-level window, even tooltips and cursors.

The SystemManager also switches focus between top-level windows if there are more than one IFocusManagerContainer displayed and users are interacting with components within the IFocusManagerContainers.

All keyboard and mouse activity that is not expressly trapped is seen by the SystemManager, making it a good place to monitor activity should you need to do so.

If an application is loaded into another application, a SystemManager will still be created, but will not manage an application window, depending on security and domain rules. Instead, it will be the content of the Loader that loaded it and simply serve as the parent of the sub-application

The SystemManager maintains multiple lists of children, one each for tooltips, cursors, popup windows. This is how it ensures that popup windows "float" above the main application windows and that tooltips "float" above that and cursors above that. If you simply examine the numChildren property or call the getChildAt() method on the SystemManager, you are accessing the main application window and any other windows that aren't popped up. To get the list of all windows, including popups, tooltips and cursors, use the rawChildren property.

The SystemManager is the first display class created within an application. It is responsible for creating an mx.preloaders.Preloader that displays and mx.preloaders.DownloadProgressBar while the application finishes loading, then creates the mx.core.Application instance.



Public Properties
 PropertyDefined by
  application : IUIComponent
[read-only] The application parented by this SystemManager.
SystemManager
  childAllowsParent : Boolean
[read-only] Tests if the child allows its parent to access its display objects or listen to messages that originate in the child.
SystemManager
  cursorChildren : IChildList
[read-only] An list of the custom cursors being parented by this ISystemManager.
SystemManager
  document : Object
A reference to the document object.
SystemManager
  embeddedFontList : Object
[read-only] A table of embedded fonts in this application.
SystemManager
  explicitHeight : Number
The explicit width of this object.
SystemManager
  explicitWidth : Number
The explicit width of this object.
SystemManager
  focusPane : Sprite
The focus pane associated with this object.
SystemManager
  height : Number
The height of this object.
SystemManager
  measuredHeight : Number
[read-only] The measuredHeight is the explicit or measuredHeight of the main mx.core.Application window or the starting height of the SWF if the main window has not yet been created or does not exist.
SystemManager
  measuredWidth : Number
[read-only] The measuredWidth is the explicit or measuredWidth of the main mx.core.Application window, or the starting width of the SWF if the main window has not yet been created or does not exist.
SystemManager
  numChildren : int
[read-only] The number of non-floating windows.
SystemManager
  numModalWindows : int
The number of modal windows.
SystemManager
  parent : DisplayObjectContainer
[read-only] Override parent property to handle the case where the parent is in a differnt sandbox.
SystemManager
  parentAllowsChild : Boolean
[read-only] Tests if the parent allows its child to access its display objects or listen to messages that originate in the parent.
SystemManager
  popUpChildren : IChildList
[read-only] An list of the topMost (popup) windows being parented by this ISystemManager.
SystemManager
  preloaderBackgroundAlpha : Number
[read-only] The background alpha used by the child of the preloader.
SystemManager
  preloaderBackgroundColor : uint
[read-only] The background color used by the child of the preloader.
SystemManager
  preloaderBackgroundImage : Object
[read-only] The background color used by the child of the preloader.
SystemManager
  preloaderBackgroundSize : String
[read-only] The background size used by the child of the preloader.
SystemManager
  rawChildren : IChildList
[read-only] A list of all children being parented by this ISystemManager.
SystemManager
  screen : Rectangle
[read-only] The size and position of the application window.
SystemManager
  swfBridge : IEventDispatcher
[read-only] A bridge to the application that is associated with the implementor of this interface.
SystemManager
  swfBridgeGroup : ISWFBridgeGroup
SystemManager
  toolTipChildren : IChildList
[read-only] A list of the tooltips being parented by this ISystemManager.
SystemManager
  topLevelSystemManager : ISystemManager
[read-only] Returns the SystemManager responsible for the application window.
SystemManager
  width : Number
The width of this object.
SystemManager
Public Methods
 MethodDefined by
  
Constructor.
SystemManager
  
Activates the FocusManager in an IFocusManagerContainer.
SystemManager
  
addChildBridge(bridge:IEventDispatcher, owner:DisplayObject):void
Add a bridge to talk to the child owned by owner.
SystemManager
  
addChildToSandboxRoot(layer:String, child:DisplayObject):void
Adds a child to the requested childList.
SystemManager
  
Registers a top-level window containing a FocusManager.
SystemManager
  
create(... params):Object
A factory method that requests an instance of a definition known to the module.
SystemManager
  
Deactivates the FocusManager in an IFocusManagerContainer, and activate the FocusManager of the next highest window that is an IFocusManagerContainer.
SystemManager
  
deployMouseShields(deploy:Boolean):void
Deploy or remove mouse shields.
SystemManager
  
dispatchEventFromSWFBridges(event:Event, skip:IEventDispatcher = null, trackClones:Boolean = false, toOtherSystemManagers:Boolean = false):void
Dispatch a message to all parent and child applications in this SystemManager's SWF bridge group, regardless of whether they are in the same SecurityDomain or not.
SystemManager
  
getDefinitionByName(name:String):Object
Converts the given String to a Class or package-level Function.
SystemManager
  
A convenience method for determining whether to use the explicit or measured height.
SystemManager
  
A convenience method for determining whether to use the explicit or measured width.
SystemManager
  
getSandboxRoot():DisplayObject
Go up the parent chain to get the top level system manager in this SecurityDomain.
SystemManager
  
getSWFRoot(object:Object):DisplayObject
[static] Returns the root DisplayObject of the SWF that contains the code for the given object.
SystemManager
  
getTopLevelRoot():DisplayObject
Go up the parent chain to get the top level system manager.
SystemManager
  
getVisibleApplicationRect(bounds:Rectangle = null):Rectangle
Get the bounds of the loaded application that are visible to the user on the screen.
SystemManager
  
isFontFaceEmbedded(textFormat:TextFormat):Boolean
Returns true if the required font face is embedded in this application, or has been registered globally by using the Font.registerFont() method.
SystemManager
  
isTopLevel():Boolean
Returns true if this ISystemManager is responsible for an application window, and false if this application has been loaded into another application.
SystemManager
  
isTopLevelRoot():Boolean
Tests if this system manager is the root of all top level system managers.
SystemManager
  
isTopLevelWindow(object:DisplayObject):Boolean
Determines if the given DisplayObject is the top-level window.
SystemManager
  
move(x:Number, y:Number):void
Calling the move() method has no effect as it is directly mapped to the application window or the loader.
SystemManager
  
removeChildBridge(bridge:IEventDispatcher):void
Remove a child bridge.
SystemManager
  
removeChildFromSandboxRoot(layer:String, child:DisplayObject):void
Removes a child from the requested childList.
SystemManager
  
Unregisters a top-level window containing a FocusManager.
SystemManager
  
setActualSize(newWidth:Number, newHeight:Number):void
Calling the setActualSize() method has no effect if it is directly mapped to the application window and if it is the top-level window.
SystemManager
  
useSWFBridge():Boolean
Determines if the caller using this system manager should should communicate directly with other managers or if it should communicate with a bridge.
SystemManager
Events
 EventSummaryDefined by
   Dispatched when the application has finished initializing SystemManager
   Dispatched every 100 milliseconds when there has been no keyboard or mouse activity for 1 second.SystemManager
   Dispatched when the Stage is resized.SystemManager
Property detail
applicationproperty
application:IUIComponent  [read-only]

The application parented by this SystemManager. SystemManagers create an instance of an Application even if they are loaded into another Application. Thus, this may not match mx.core.Application.application if the SWF has been loaded into another application.

Note that this property is not typed as mx.core.Application because of load-time performance considerations but can be coerced into an mx.core.Application.

Implementation
    public function get application():IUIComponent
childAllowsParentproperty 
childAllowsParent:Boolean  [read-only]

Tests if the child allows its parent to access its display objects or listen to messages that originate in the child. true if access if allowed; otherwise false.

Implementation
    public function get childAllowsParent():Boolean
cursorChildrenproperty 
cursorChildren:IChildList  [read-only]

An list of the custom cursors being parented by this ISystemManager.

An ISystemManager has various types of children, such as the Application, popups, top-most windows, tooltips, and custom cursors. You can access the custom cursors through the cursorChildren property.

The IChildList object has methods like getChildAt() and properties like numChildren. For example, cursorChildren.numChildren gives the number of custom cursors (which will be either 0 or 1) and, if a custom cursor exists, you can access it as cursorChildren.getChildAt(0).

Implementation
    public function get cursorChildren():IChildList
documentproperty 
document:Object  [read-write]

A reference to the document object. A document object is an Object at the top of the hierarchy of a Flex application, MXML component, or AS component.

Implementation
    public function get document():Object
    public function set document(value:Object):void
embeddedFontListproperty 
embeddedFontList:Object  [read-only]

A table of embedded fonts in this application. The object is a table indexed by the font name.

Implementation
    public function get embeddedFontList():Object
explicitHeightproperty 
explicitHeight:Number  [read-write]

The explicit width of this object. For the SystemManager this should always be NaN unless the application was loaded into another application. If the application was not loaded into another application, setting this value has no effect.

Implementation
    public function get explicitHeight():Number
    public function set explicitHeight(value:Number):void
explicitWidthproperty 
explicitWidth:Number  [read-write]

The explicit width of this object. For the SystemManager this should always be NaN unless the application was loaded into another application. If the application was not loaded into another application, setting this value has no effect.

Implementation
    public function get explicitWidth():Number
    public function set explicitWidth(value:Number):void
focusPaneproperty 
focusPane:Sprite  [read-write]

The focus pane associated with this object. An object has a focus pane when one of its children has focus.

Implementation
    public function get focusPane():Sprite
    public function set focusPane(value:Sprite):void
heightproperty 
height:Number  [read-write]

The height of this object. For the SystemManager this should always be the width of the stage unless the application was loaded into another application. If the application was not loaded into another application, setting this value has no effect.

Implementation
    public function get height():Number
    public function set height(value:Number):void
measuredHeightproperty 
measuredHeight:Number  [read-only]

The measuredHeight is the explicit or measuredHeight of the main mx.core.Application window or the starting height of the SWF if the main window has not yet been created or does not exist.

Implementation
    public function get measuredHeight():Number
measuredWidthproperty 
measuredWidth:Number  [read-only]

The measuredWidth is the explicit or measuredWidth of the main mx.core.Application window, or the starting width of the SWF if the main window has not yet been created or does not exist.

Implementation
    public function get measuredWidth():Number
numChildrenproperty 
numChildren:int  [read-only]

The number of non-floating windows. This is the main application window plus any other windows added to the SystemManager that are not popups, tooltips or cursors.

Implementation
    public function get numChildren():int
numModalWindowsproperty 
numModalWindows:int  [read-write]

The number of modal windows. Modal windows don't allow clicking in another windows which would normally activate the FocusManager in that window. The PopUpManager modifies this count as it creates and destroys modal windows.

Implementation
    public function get numModalWindows():int
    public function set numModalWindows(value:int):void
parentproperty 
parent:DisplayObjectContainer  [read-only]

Override parent property to handle the case where the parent is in a differnt sandbox. If the parent is in the same sandbox it is returned. If the parent is in a diffent sandbox, then null is returned.

Implementation
    public function get parent():DisplayObjectContainer
parentAllowsChildproperty 
parentAllowsChild:Boolean  [read-only]

Tests if the parent allows its child to access its display objects or listen to messages that originate in the parent. true if access if allowed; otherwise false.

Implementation
    public function get parentAllowsChild():Boolean
popUpChildrenproperty 
popUpChildren:IChildList  [read-only]

An list of the topMost (popup) windows being parented by this ISystemManager.

An ISystemManager has various types of children, such as the Application, popups, tooltips, and custom cursors. You can access the top-most windows through the popUpChildren property.

The IChildList object has methods like getChildAt() and properties like numChildren. For example, popUpChildren.numChildren gives the number of topmost windows and you can access them as popUpChildren.getChildAt(i).

Implementation
    public function get popUpChildren():IChildList
preloaderBackgroundAlphaproperty 
preloaderBackgroundAlpha:Number  [read-only]

The background alpha used by the child of the preloader.

Implementation
    public function get preloaderBackgroundAlpha():Number
preloaderBackgroundColorproperty 
preloaderBackgroundColor:uint  [read-only]

The background color used by the child of the preloader.

Implementation
    public function get preloaderBackgroundColor():uint
preloaderBackgroundImageproperty 
preloaderBackgroundImage:Object  [read-only]

The background color used by the child of the preloader.

Implementation
    public function get preloaderBackgroundImage():Object
preloaderBackgroundSizeproperty 
preloaderBackgroundSize:String  [read-only]

The background size used by the child of the preloader.

Implementation
    public function get preloaderBackgroundSize():String
rawChildrenproperty 
rawChildren:IChildList  [read-only]

A list of all children being parented by this ISystemManager.

An ISystemManager has various types of children, such as the Application, popups, tooltips, and custom cursors.

The IChildList object has methods like getChildAt() and properties like numChildren.

Implementation
    public function get rawChildren():IChildList
screenproperty 
screen:Rectangle  [read-only]

The size and position of the application window. The Rectangle object contains x, y, width, and height properties.

Implementation
    public function get screen():Rectangle
swfBridgeproperty 
swfBridge:IEventDispatcher  [read-only]

A bridge to the application that is associated with the implementor of this interface. The IEventDispatcher that can be used to send events to an application in a different ApplicationDomain or a different sandbox.

Implementation
    public function get swfBridge():IEventDispatcher
swfBridgeGroupproperty 
swfBridgeGroup:ISWFBridgeGroup  [read-write]Implementation
    public function get swfBridgeGroup():ISWFBridgeGroup
    public function set swfBridgeGroup(value:ISWFBridgeGroup):void
toolTipChildrenproperty 
toolTipChildren:IChildList  [read-only]

A list of the tooltips being parented by this ISystemManager.

An ISystemManager has various types of children, such as the Application, popups, topmost windows, tooltips, and custom cursors.

The IChildList object has methods like getChildAt() and properties like numChildren. For example, toolTipChildren.numChildren gives the number of tooltips (which will be either 0 or 1) and, if a tooltip exists, you can access it as toolTipChildren.getChildAt(0).

Implementation
    public function get toolTipChildren():IChildList
topLevelSystemManagerproperty 
topLevelSystemManager:ISystemManager  [read-only]

Returns the SystemManager responsible for the application window. This will be the same SystemManager unless this application has been loaded into another application.

Implementation
    public function get topLevelSystemManager():ISystemManager
widthproperty 
width:Number  [read-write]

The width of this object. For the SystemManager this should always be the width of the stage unless the application was loaded into another application. If the application was not loaded into another application, setting this value will have no effect.

Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor detail
SystemManager()constructor
public function SystemManager()

Constructor.

This is the starting point for all Flex applications. This class is set to be the root class of a Flex SWF file. Flash Player instantiates an instance of this class, causing this constructor to be called.

Method detail
activate()method
public function activate(f:IFocusManagerContainer):void

Activates the FocusManager in an IFocusManagerContainer.

Parameters
f:IFocusManagerContainer — IFocusManagerContainer the top-level window whose FocusManager should be activated.
addChildBridge()method 
public function addChildBridge(bridge:IEventDispatcher, owner:DisplayObject):void

Add a bridge to talk to the child owned by owner.

Parameters
bridge:IEventDispatcher — The bridge used to talk to the parent.
 
owner:DisplayObject — The display object that owns the bridge.
addChildToSandboxRoot()method 
public function addChildToSandboxRoot(layer:String, child:DisplayObject):void

Adds a child to the requested childList.

Parameters
layer:String — The child list that the child should be added to. The valid choices are "popUpChildren", "cursorChildren", and "toolTipChildren". The choices match the property names of ISystemManager and that is the list where the child is added.
 
child:DisplayObject — The child to add.
addFocusManager()method 
public function addFocusManager(f:IFocusManagerContainer):void

Registers a top-level window containing a FocusManager. Called by the FocusManager, generally not called by application code.

Parameters
f:IFocusManagerContainer — The top-level window in the application.
create()method 
public function create(... params):Object

A factory method that requests an instance of a definition known to the module. You can provide an optional set of parameters to let building factories change what they create based on the input. Passing null indicates that the default definition is created, if possible. This method is overridden in the autogenerated subclass.

Parameters
... params — An optional list of arguments. You can pass any number of arguments, which are then stored in an Array called parameters.

Returns
Object — An instance of the module, or null.
deactivate()method 
public function deactivate(f:IFocusManagerContainer):void

Deactivates the FocusManager in an IFocusManagerContainer, and activate the FocusManager of the next highest window that is an IFocusManagerContainer.

Parameters
f:IFocusManagerContainer — IFocusManagerContainer the top-level window whose FocusManager should be deactivated.
deployMouseShields()method 
public function deployMouseShields(deploy:Boolean):void

Deploy or remove mouse shields. Mouse shields block mouse input to untrusted applications. The reason you would want to block mouse input is because when you are dragging over an untrusted application you would normally not receive any mouse move events. The Flash Player does not send events across trusted/untrusted boundries due to security concerns. By covering the untrusted application with a mouse shield (assuming you are its parent) you can get mouse move message and the drag operation will work as expected.

Parameters
deploy:Booleantrue to deploy the mouse shields, false to remove the mouse shields.
dispatchEventFromSWFBridges()method 
public function dispatchEventFromSWFBridges(event:Event, skip:IEventDispatcher = null, trackClones:Boolean = false, toOtherSystemManagers:Boolean = false):void

Dispatch a message to all parent and child applications in this SystemManager's SWF bridge group, regardless of whether they are in the same SecurityDomain or not. You can optionally exclude an application with this method's parameters.

Parameters
event:Event — The event to dispatch.
 
skip:IEventDispatcher (default = null) — Specifies an IEventDispatcher that you do not want to dispatch a message to. This is typically used to skip the IEventDispatcher that originated the event.
 
trackClones:Boolean (default = false) — Whether to keep a reference to the events as they are dispatched.
 
toOtherSystemManagers:Boolean (default = false) — Whether to dispatch the event to other top-level SystemManagers in AIR.
getDefinitionByName()method 
public function getDefinitionByName(name:String):Object

Converts the given String to a Class or package-level Function. Calls the appropriate ApplicationDomain.getDefinition() method based on whether you are loaded into another application or not.

Parameters
name:String — Name of class, for example "mx.video.VideoManager".

Returns
Object — The Class represented by the name, or null.
getExplicitOrMeasuredHeight()method 
public function getExplicitOrMeasuredHeight():Number

A convenience method for determining whether to use the explicit or measured height.

Returns
Number — A Number that is the explicitHeight if defined, or the measuredHeight property if not.
getExplicitOrMeasuredWidth()method 
public function getExplicitOrMeasuredWidth():Number

A convenience method for determining whether to use the explicit or measured width.

Returns
Number — A Number that is the explicitWidth if defined, or the measuredWidth property if not.
getSandboxRoot()method 
public function getSandboxRoot():DisplayObject

Go up the parent chain to get the top level system manager in this SecurityDomain.

Returns
DisplayObject — The root system manager in this SecurityDomain.
getSWFRoot()method 
public static function getSWFRoot(object:Object):DisplayObject

Returns the root DisplayObject of the SWF that contains the code for the given object.

Parameters
object:Object — Any Object.

Returns
DisplayObject — The root DisplayObject
getTopLevelRoot()method 
public function getTopLevelRoot():DisplayObject

Go up the parent chain to get the top level system manager. Returns null if not on the display list or we don't have access to the top-level system manager.

Returns
DisplayObject — The root system manager.
getVisibleApplicationRect()method 
public function getVisibleApplicationRect(bounds:Rectangle = null):Rectangle

Get the bounds of the loaded application that are visible to the user on the screen.

Parameters
bounds:Rectangle (default = null) — Optional. The starting bounds for the visible rect. The bounds are in global coordinates. If bounds is null the starting bounds is defined by the screen property of the system manager.

Returns
Rectangle — a Rectangle including the visible portion of the this object. The rectangle is in global coordinates.
isFontFaceEmbedded()method 
public function isFontFaceEmbedded(textFormat:TextFormat):Boolean

Returns true if the required font face is embedded in this application, or has been registered globally by using the Font.registerFont() method.

Parameters
textFormat:TextFormat — The TextFormat class representing character formatting information.

Returns
Booleantrue if the required font face is embedded in this application, or has been registered globally by using the Font.registerFont() method.
isTopLevel()method 
public function isTopLevel():Boolean

Returns true if this ISystemManager is responsible for an application window, and false if this application has been loaded into another application.

Returns
Booleantrue if this ISystemManager is responsible for an application window.
isTopLevelRoot()method 
public function isTopLevelRoot():Boolean

Tests if this system manager is the root of all top level system managers.

Returns
Booleantrue if the SystemManager is the root of all SystemManagers on the display list, and false otherwise.
isTopLevelWindow()method 
public function isTopLevelWindow(object:DisplayObject):Boolean

Determines if the given DisplayObject is the top-level window.

Parameters
object:DisplayObject — The DisplayObject to test.

Returns
Booleantrue if the given DisplayObject is the top-level window.
move()method 
public function move(x:Number, y:Number):void

Calling the move() method has no effect as it is directly mapped to the application window or the loader.

Parameters
x:Number — The new x coordinate.
 
y:Number — The new y coordinate.
removeChildBridge()method 
public function removeChildBridge(bridge:IEventDispatcher):void

Remove a child bridge.

Parameters
bridge:IEventDispatcher — The target bridge to remove.
removeChildFromSandboxRoot()method 
public function removeChildFromSandboxRoot(layer:String, child:DisplayObject):void

Removes a child from the requested childList.

Parameters
layer:String — The child list that the child should be removed from. The valid choices are "popUpChildren", "cursorChildren", and "toolTipChildren". The choices match the property names of ISystemManager and that is the list where the child is removed from.
 
child:DisplayObject — The child to remove.
removeFocusManager()method 
public function removeFocusManager(f:IFocusManagerContainer):void

Unregisters a top-level window containing a FocusManager. Called by the FocusManager, generally not called by application code.

Parameters
f:IFocusManagerContainer — The top-level window in the application.
setActualSize()method 
public function setActualSize(newWidth:Number, newHeight:Number):void

Calling the setActualSize() method has no effect if it is directly mapped to the application window and if it is the top-level window. Otherwise attempts to resize itself, clipping children if needed.

Parameters
newWidth:Number — The new width.
 
newHeight:Number — The new height.
useSWFBridge()method 
public function useSWFBridge():Boolean

Determines if the caller using this system manager should should communicate directly with other managers or if it should communicate with a bridge.

Returns
Booleantrue if the caller using this system manager should communicate using sandbox bridges. If false the system manager may directly call other managers directly via references.
Event detail
applicationCompleteevent 
Event object type: mx.events.FlexEvent
FlexEvent.type property = mx.events.FlexEvent.APPLICATION_COMPLETE

Dispatched when the application has finished initializing

The FlexEvent.APPLICATION_COMPLETE constant defines the value of the type property of the event object for a applicationComplete event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
idleevent  
Event object type: mx.events.FlexEvent
FlexEvent.type property = mx.events.FlexEvent.IDLE

Dispatched every 100 milliseconds when there has been no keyboard or mouse activity for 1 second.

The FlexEvent.IDLE constant defines the value of the type property of the event object for a idle event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
resizeevent  
Event object type: flash.events.Event

Dispatched when the Stage is resized.