View comments | RSS feed
Methods | Properties | Effects | Events | Styles | Examples Frames | No Frames

mx.controls
Class Alert

Inheritance ImageInheritance ImageInheritance ImageInheritance ImageInheritance ImageInheritance ImageInheritance Image


class Alert
extends mx.containers.Panel

The Alert control is a pop-up dialog box that contains a title, buttons (such as OK, Cancel, etc.) and an icon. It is normally used by application programmers to convey the occurance of an unexpected event in the system.

You use the static show() method to display an Alert control, or for convenience you can use Application.alert().

Click here to view the Examples

See Also
    mx.managers.SystemManager
    mx.managers.PopUpManager
    alertClasses.AlertForm



Methods
       getViewMetrics( ) :  Object
Gets the thickness of the edges of the Alert dialog, including the border, title bar, and scroll bars, if visible.
staticshow( text: String, title: String, flags: Number, parent: MovieClip, listener, icon: String, defButton: Number) :  mx.controls.Alert
Static method that shows the Alert control with the title, message, and requested buttons.

Methods inherited from class mx.containers.Panel
deletePopUp   getViewMetrics   measure  

Methods inherited from class mx.containers.Box
layoutChildren   measure   pixelsToPercent   setRelativeChildHeights   setRelativeChildWidths  

Methods inherited from class mx.containers.Container
createChildren   draw   executeChildBindings   getViewMetrics   getViewMetricsAndMargins   init  

Methods inherited from class mx.core.View
childLoaded   constructObject2   createChild   createChildren   destroyAllChildren   destroyChild   destroyChildAt   draw   getBorderMetrics   getChildAt   getChildIndex   getViewMetrics   init   layoutChildren   layoutChrome   setChildIndex  

Methods inherited from class mx.core.UIComponent
drawFocus   getFocus   getFocusManager   setEnabled   setFocus  

Methods inherited from class mx.core.UIObject
addEventListener   applyProperties   buildDepthTable   commitProperties   constructObject2   createAccessibilityImplementation   createChildAtDepth   createChildren   createClassChildAtDepth   createClassObject   createEmptyObject   destroyObject   dispatchEvent   doLater   draw   drawRect   executeBindings   fillRect   findNextAvailableDepth   getRepeaterItem   getStyle   handleEvent   init   invalidate   invalidateLayout   invalidateProperties   invalidateSize   invalidateStyle   layoutChildren   measure   move   redraw   removeEventListener   setDepthAbove   setDepthBelow   setMask   setSize   setSizeNoLayout   setStyle   swapDepths  



Properties
staticbuttonHeight: Number
Height of Alert buttons, in pixels.
staticbuttonStyleDeclaration: String
Style declaration name for the button text.
staticbuttonWidth: Number
Width of Alert buttons, in pixels.
staticCANCEL: Number
Flag used for enabling a 'Cancel' button on the Alert
staticcancelLabel: String
Label for the Cancel button.
staticmessageStyleDeclaration: String
Style declaration name for the message text.
staticNO: Number
Flag used for enabling a 'No' button on the Alert
staticnoLabel: String
Label for the No button.
staticOK: Number
Flag used for enabling a 'OK' button on the Alert
staticokLabel: String
Label for the OK button.
statictitleStyleDeclaration: String
Style declaration name for the text in the title bar.
staticversion: String
Version string for this class.
staticYES: Number
Flag used for enabling a 'Yes' button on the Alert
staticyesLabel: String
Label for the Yes button.

Properties inherited from class mx.containers.Panel
className   status   statusStyleDeclaration   title   titleStyleDeclaration   version  

Properties inherited from class mx.containers.Box
direction  

Properties inherited from class mx.containers.Container
autoLayout   childDescriptors   className   clipContent   creationIndex   creationPolicy   defaultButton   hLineScrollSize   hPageScrollSize   hPosition   hScrollPolicy   icon   label   maxHPosition   maxVPosition   numRepeaters   version   vLineScrollSize   vPageScrollSize   vPosition   vScrollPolicy  

Properties inherited from class mx.core.View
baselinePosition   className   numChildren   version  

Properties inherited from class mx.core.UIComponent
enabled   errorString   tabEnabled   tabIndex   version  

Properties inherited from class mx.core.UIObject
alpha   baselinePosition   className   depth   documentDescriptor   height   heightFlex   id   instanceIndices   isDocument   kStretch   layoutHeight   layoutWidth   maxHeight   maxWidth   minHeight   minWidth   mouseX   mouseY   nestLevel   oldHeight   oldWidth   oldX   oldY   parent   parentApplication   parentDocument   percentHeight   percentWidth   preferredHeight   preferredWidth   repeaterIndices   scaleX   scaleY   styleName   tabEnabled   toolTip   version   visible   width   widthFlex   x   y  



Effects

Effects inherited from class mx.containers.Panel
resizeEndEffect   resizeStartEffect  

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.Panel
click  mouseDownOutside 

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 

Events inherited from class: mx.core.UIObject
creationComplete  dragComplete  dragDrop  dragEnter  dragExit  dragOver  draw  effectEnd  effectStart  hide  hideToolTip  initialize  load  mouseChangeSomewhere  mouseDown  mouseDownSomewhere  mouseMove  mouseMoveSomewhere  mouseOut  mouseOver  mouseUp  mouseUpSomewhere  move  resize  show  showToolTip  unload 



Styles

Styles inherited from class mx.containers.Panel
cornerRadius   dropShadow   footerColors   headerColors   headerHeight   panelBorderStyle   shadowDirection   shadowDistance  

Styles inherited from class mx.containers.Box
horizontalAlign   horizontalGap   marginBottom   marginTop   verticalAlign   verticalGap  

Styles inherited from class mx.core.UIComponent
backgroundAlpha   backgroundColor   backgroundDisabledColor   backgroundImage   backgroundSize   barColor   borderCapColor   borderColor   borderSides   borderStyle   borderThickness   cornerRadius   disabledColor   dropShadow   errorColor   fillColors   highlightColor   modalTransparency   scrollTrackColor   selectedFillColors   shadowCapColor   shadowColor   shadowDirection   shadowDistance   symbolBackgroundColor   symbolBackgroundDisabledColor   symbolBackgroundPressedColor   symbolColor   symbolDisabledColor   themeColor  

Styles inherited from class mx.core.UIObject
color   fontFamily   fontSize   fontStyle   fontWeight   horizontalGap   leading   marginLeft   marginRight   textAlign   textDecoration   textIndent   verticalGap  



Method Detail

getViewMetrics

getViewMetrics( ) :  Object

Gets the thickness of the edges of the Alert dialog, including the border, title bar, and scroll bars, if visible.

Returns
     Object with left, right, top, and bottom edge thickness in pixels.


show

static  show( text: String, title: String, flags: Number, parent: MovieClip, listener, icon: String, defButton: Number) :  mx.controls.Alert

Static method that shows the Alert control with the title, message, and requested buttons.

Note: The Alert.show() and Application.alert() methods appear similar but have different parameter ordering.

Also note that icon is a URL to an image file that appears in the control. Image types include JPEG, GIF, PNG, BMP, and SWF. You use the following format with this property:
icon="@Embed('relOrAbsoluteURL')"
The referenced image is packaged in the generated SWF file at compile time when Flex creates the SWF file for your application.

Parameters
    text: String - Text string that appears in the Alert control.
    title: String - Text string in the title bar.
    flags: Number - Which buttons to place in the Alert control. Valid values are YES, NO, CANCEL, OK. Use the bitwise OR operator to enable more than one button. For example (Alert.YES | Alert.NO).
    parent: MovieClip - Object upon which the Alert control centers itself.
    listener - object that is triggered when any button on the Alert control is pressed. The object should have a click() method in order to get correctly called.
    icon: String - Icon that is placed to the left of the text in the Alert control.
    defButton: Number - the default button; One of YES, NO, CANCEL, OK.



Property Detail

buttonHeight

static  buttonHeight: Number  

Height of Alert buttons, in pixels. The default value is 22 pixels.


buttonStyleDeclaration

static  buttonStyleDeclaration: String  

Style declaration name for the button text.


buttonWidth

static  buttonWidth: Number  

Width of Alert buttons, in pixels. The default value is 50 pixels.


CANCEL

static  CANCEL: Number  

Flag used for enabling a 'Cancel' button on the Alert


cancelLabel

static  cancelLabel: String  

Label for the Cancel button. The default value is "Cancel".


messageStyleDeclaration

static  messageStyleDeclaration: String  

Style declaration name for the message text.


NO

static  NO: Number  

Flag used for enabling a 'No' button on the Alert


noLabel

static  noLabel: String  

Label for the No button. The default value is "No".


OK

static  OK: Number  

Flag used for enabling a 'OK' button on the Alert


okLabel

static  okLabel: String  

Label for the OK button. The default value is "OK".


titleStyleDeclaration

static  titleStyleDeclaration: String  

Style declaration name for the text in the title bar.


version

static  version: String  

Version string for this class.


YES

static  YES: Number  

Flag used for enabling a 'Yes' button on the Alert


yesLabel

static  yesLabel: String  

Label for the Yes button. The default value is "Yes".


Examples
SimpleAlert.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Alert control -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">

    <mx:Script>
        <![CDATA[
        
        import mx.controls.Alert;
       
        /** Event handler function imports the Alert control, which uses a static method to show
           a pop-up window with the title, message, and requested buttons.
        **/        
        function Alerted()
        {
            Alert.show("You have been alerted !!", "Alert Box",Alert.OK);
        }
    
    ]]>
    
    </mx:Script>

    <mx:Panel title="Alert Panel" marginTop="10">

        <mx:Button label="Alert me" click="Alerted();"/>

    </mx:Panel>

</mx:Application>
       




Comments


Eric Raymond said on Apr 8, 2005 at 2:51 PM :
The click handler is called with an event object as a parameter. The detail property on the event indicates which button was pressed.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/controls/Alert.html