Flex defines a default, or Application, container that lets you start adding content to your application without explicitly defining another container. Flex creates this container from the <mx:Application> tag, the first tag in an MXML application file. While you might find it convenient to use the Application container as the only container in your application, in most cases you explicitly define at least one more container before you add any controls to your application.
The Application container is a Box container with the direction set to Vertical by default. It inherits all of the properties of the Box container. This means you can use all of the MXML tag properties and ActionScript methods of the Box container with the <mx:Application> tag.
To revert the style settings of the Application to the plain settings, use the following:
<mx:Application styleName="plain" />
MXML Syntax
The <mx:Application>tag inherits all the properties of it parent classes, except for the direction property of Box, and the following properties:
<mx:ApplicationThe following MXML properties are built into the compiler, not into the Application class itself. For more information, see the chapter `Using the Application Container` in the `Developing Flex Applications` book:
application="No default."
backgroundImage="Defaults to gray gradient"
backgroundSize="100%"
frameRate="24"
height="100%"
horizontaAlign="center|left|right"
horizontalGap="8"
marginBottom="24"
marginTop="24"
pageTitle"No default."
preloader="No default."
resetHistory="true|false"
scriptRecursionLimit="1000"
scriptTimeLimit="60"
selfContained=""
theme="No default."
usePreloader="true|false"
verticalAlign="top|bottom|middle"
verticalGap="8">
width="100%"
xmlns="No default."
...
child tags
...
/>
frameRate: Specifies the frame rate of the application. The default value is 24. pageTitle: Specifies a string that appears in the title bar of the browser. This property provides the same functionality as the HTML <title> tag. preloader: Specifies the path of a SWC component class or ActionScript component class that defines a custom progress bar. A SWC component must be in the same directory as the MXML file or in the WEB-INF/flex/user_classes directory of your Flex web application. scriptRecursionLimit: Specifies the maximum depth of the Macromedia Flash Player call stack before Flash Player stops. This is essentially the stack overflow limit.The default value is 1000. scriptTimeLimit: Specifies the maximum duration, in seconds, that an ActionScript event handler can execute before the Flash Player assumes that it is hung, and aborts it. The default value is 60 seconds. usePreloader: Specifies whether to disable the application preloader, false, or not, true. The default value is true. theme: Specifies a theme SWC file that contains skins for your application. Flex searches for the specified SWC file in a location relative to the MXML file. xmlns: Specifies a namespace definition.
See Also
mx.containers.Box
mx.containers.HBox
mx.controls.Alert
mx.managers.CursorManager
mx.managers.HistoryManager
mx.managers.LayoutManager
mx.managers.SystemManager
mx.managers.DepthManager
mx.managers.PopUpManager
mx.events.EventDispatcher
| Constructors | |
Application
()
This Application constructor never gets called because Flex`s Application object is actually the _root object of the Flash Player; the _root object pre-exists and doesn`t get constructed. |
|
| Methods | |
static | alert(message:String, title:String, flags:Number, clickHandler, defaultButton:Number, icon:String)
: Number Displays a modal dialog box on top of the existing frame. |
| constructObject()
: Void This is the first Flex framework method that gets called. |
static | getURL(url, window, variables)
Loads a document from the specified URL into the specified window. |
| handleEvent(event:Object)
: Void Triggered by an error or warning event. |
| isFontEmbedded(fontFace:String)
: Boolean Returns true if a font face is embedded, and false if it is not. |
| onSetFocus(o:Object, n:Object)
: Void Notifies that there is a change in focus. |
| popupWindow(className:Object, initObj:Object)
: MovieClip Creates a pop-up TitleWindow container. |
| resize()
Triggered by a resize event of the stage. |
| Methods inherited from class mx.containers.Box |
layoutChildren measure setRelativeChildHeights setRelativeChildWidths |
| Methods inherited from class mx.containers.Container |
createChildren createComponent createComponents draw getViewMetrics init |
| Methods inherited from class mx.core.View |
childLoaded createChild createChildren destroyAllChildren destroyChild destroyChildAt draw getChildAt getChildIndex getViewMetrics init layoutChildren setChildIndex |
| Methods inherited from class mx.core.UIComponent |
drawFocus getFocus getFocusManager setEnabled setFocus |
| Properties | |
static | CANCEL:Number Hex value for the Cancel button that is used later for bitwise comparison. |
static | NO:Number Hex value for the No button that is used later for bitwise comparison. |
static | NONMODAL:Number Hex value for non-modal that is used later for bitwise comparison. |
static | OK:Number Hex value for the OK button that is used later for bitwise comparison. |
static | YES:Number Hex value for the Yes button that is used later for bitwise comparison. |
static | application:Object A reference to the top-level application. |
| className:String Name of this class. |
| resetHistory:var [Read-Write]
If true, the application`s history state is reset to its initial state whenever the application is reloaded. |
| selfContained:var [Read-Write]
Indicates whether a SWF is entirely self-referencing or needs to access anything in the loading SWF. |
static | version:StringVersion string for this class. |
| Properties inherited from class mx.containers.Box |
direction |
| Properties inherited from class mx.core.View |
baselinePosition className numChildren tabIndex version |
| Properties inherited from class mx.core.UIComponent |
enabled errorString tabEnabled tabIndex version |
| Effects |
| Effects inherited from class mx.core.UIComponent |
focusInEffect focusOutEffect |
| Effects inherited from class mx.core.UIObject |
creationCompleteEffect hideEffect mouseDownEffect mouseOutEffect mouseOverEffect mouseUpEffect moveEffect resizeEffect showEffect |
| Events |
| Events inherited from class: mx.containers.Container |
childrenCreated scroll |
| Events inherited from class: mx.core.View |
childCreated childDestroyed childIndexChanged |
| Events inherited from class: mx.core.UIComponent |
focusIn focusOut invalid keyDown keyUp valid valueCommitted |
| Styles |
| Styles inherited from class mx.containers.Box |
horizontalAlign horizontalGap marginBottom marginTop verticalAlign verticalGap |
| Styles inherited from class mx.core.UIObject |
color fontFamily fontSize fontStyle fontWeight horizontalGap marginLeft marginRight textAlign textDecoration textIndent verticalGap |
| Constructor Detail |
Application()
| Method Detail |
static alert(message:String, title:String, flags:Number, clickHandler, defaultButton:Number, icon:String)
: Number
Optional title text can appear in the title bar of the alert, along with a variety of choices of which buttons to display. The parameters map directly to those of the Alert class.
Parameters
message - Text content to display.
title - Text to display in title bar (optional).
flags - Defines buttons to display. See Alert.show(). (optional)
clickHandler - Called when a button is clicked See Alert.show(). (optional)
defaultButton - Defines the default button that is selected when the user presses the Enter key. (optional)
icon - Icon displayed to the left of message text. (optional)
Returns
Zero (0) if the Alert was displayed, non-zero otherwise.
constructObject()
: Void
static getURL(url, window, variables)
Parameters
url - A string specifying the URL.
window - The target window in which to open the URL.
variables - Do not set.
handleEvent(event:Object)
: Void
Parameters
event - Event.
isFontEmbedded(fontFace:String)
: Boolean
Parameters
fontFace - Font face to check.
onSetFocus(o:Object, n:Object)
: Void
Parameters
o - Object that had focus.
n - Object that currently has focus.
popupWindow(className:Object, initObj:Object)
: MovieClip
Parameters
className - A reference to a class. The class name should be expressed without quotation marks, as in popupWindow(mx.containers.TitleWindow).
initObj - Object that contains initialization properties. This argument is optional.
resize()
| Property Detail |
static application:Object
static CANCEL:Number
className:String
static NO:Number
static NONMODAL:Number
static OK:Number
resetHistory:var [Read-Write]
selfContained:var [Read-Write]
static version:String
static YES:Number