Mx.controls.Alert.show windowHeight

Hello All
I am trying to set windowHeight for my alert component.
Below a snippet but does not seem to work any suggestion
greatly appreciated
Adam
var myAlert;
myAlert = mx.controls.Alert.show("Please
select:\n"+msg+"","Info", {windowHeight: 400});
trace(myAlert.windowHeight); // This comes up undefined
myAlert.windowHeight = 400;
trace(myAlert.windowHeight);// This comes up 400 but does
not change alert size

It sounds like you're referencing a NULL object somewhere.  Any chance you could provide us with some sample code?  I just successfully tried the following out:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                            xmlns:s="library://ns.adobe.com/flex/spark"
                            xmlns:mx="library://ns.adobe.com/flex/mx"
                            applicationComplete="init()">
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <fx:Script>
          <![CDATA[
               import mx.controls.Alert;
               public function init():void
                    Alert.show("This is a test", "My Alert");
          ]]>
     </fx:Script>
</s:WindowedApplication>
Thanks,
Chris

Similar Messages

  • Crashing whenever using mx.controls.Alert.show

    Flex Project: Desktop (AIR)
    Flex SDK: 4.1
    Flash Builder 4
    Problem: Whenever I use Alert.show even with the simplest strings passed it crashes showing the following error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at mx.controls::Alert$/show()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\Alert.as:566]
    And it is pointing at Alert.as line:
    var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager);
    How do I use this? What's wrong? Any fix?

    It sounds like you're referencing a NULL object somewhere.  Any chance you could provide us with some sample code?  I just successfully tried the following out:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                applicationComplete="init()">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   public function init():void
                        Alert.show("This is a test", "My Alert");
              ]]>
         </fx:Script>
    </s:WindowedApplication>
    Thanks,
    Chris

  • How to autoclick/run a button after Alert.Show() Event?

    Hey Guys
    So I have a alert.show happening for something like
    public function test(evt:ResultEvent):void
    if (evt.result.success == "yes")
         mx.controls.Alert.Show("Yay!!!")
    if (evt.result.success == "no")
        mx.controls.Alert.Show("Nay")
    Now I have another button called
    <mx:Button label="Reload" id="Reload" />
    I want that if the sucess == yes scenario is run.. After the popup box comes and a person click OK.. the reload button is run..
    Please tell me how to do so??
    Regards

    You need to set up an event listener on the closeEvent.
    Here is a quick example (untested):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.events.CloseEvent;
    import mx.controls.Alert;
    private function init():void {
    Alert.show("myText", "myTitle", Alert.OK | Alert.CANCEL, this, onClose);
    private function onClose(event:CloseEvent):void {
    if (event.detail == Alert.OK) {
    trace("ok pressed");
    } else {
    trace("cancel pressed");
    ]]>
    </mx:Script>
    </mx:Application>

  • Flashbuilder 4.5 Alert.show error

    My shutdown method looks like
        private function onShutDown(event:Event):void {
                event.preventDefault();
                Alert.show("Do you REALLY want to close this application?", "Wait! Don't go!", 3, null, onConfirmation);
    And is valid but throws :
    [SWF] AirPureAS.swf - 985,029 bytes after decompression
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at mx.controls::Alert$/show()[E:\dev\hero_private\frameworks\projects\mx\src\mx\controls\Ale rt.as:566]
        at AirPureAS/onShutDown()[C:\Users\Public\Documents\workspace\study\AirPureAS\src\AirPureAS. as:64]
    Am I missing something. I have this setup so that the Flex project runs from a default .as class rather then default mxml application class.
    And it works fine. As long as I leave Alert.show alone...
    My hair is gone, my tea is cold, heeeeeelp!
    Thanks on beforehand
    Thomas

    Yes suspected last night that must be it after starting at it in debugger.
    I am devicing my own alert box as a result of that, finely designed!
    Thanks
    Thomas

  • A problem in Alert.show() in FlexSDK 11563

    Hello, I've got a problem with the Alert.show and the PopUpManager, every time an active method that ultilize these classes is displayed the following error:
    TypeError: Error #1009: Não é possível acessar uma propriedade ou um método de uma referência de objeto nula.
        at mx.managers::PopUpManagerImpl/http://www.adobe.com/2006/flex/mx/internal::createModalWindow()[E:\dev\trunk\frameworks\pr ojects\framework\src\mx\managers\PopUpManagerImpl.as:678]
        at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\trunk\frameworks\projects\framework\src\m x\managers\PopUpManagerImpl.as:393]
        at mx.managers::PopUpManager$/addPopUp()[E:\dev\trunk\frameworks\projects\framework\src\mx\m anagers\PopUpManager.as:189]
        at mx.controls::Alert$/show()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\Ale rt.as:620]
        at br.com.vpsa.view.screens.fiscal::CadastroCFOP/carregarCfop()[E:\WORKSPACES\FISCAL\fiscal\ flex_src\br\com\vpsa\view\screens\fiscal\As\CadastroCFOP.as:151]
        at br.com.vpsa.view.screens.fiscal::CadastroCFOP/___CadastroCFOP_Group1_creationComplete()[E :\WORKSPACES\FISCAL\fiscal\flex_src\br\com\vpsa\view\screens\fiscal\CadastroCFOP.mxml:6]
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\co re\UIComponent.as:11982]
        at mx.core::UIComponent/set initialized()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:1540]
        at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\trunk\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:759]
        at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\trunk\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1069]

    This could be the same problem as https://bugs.adobe.com/jira/browse/SDK-24060. Watch the bug for updates. It should be fixed very soon.
    -Darrell

  • Help with Alert.show()

    I need help with Alert.show(). My goal is to display a message box when a button is pressed.
    My program header:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    actionBarVisible="true" fontWeight="normal" overlayControls="false"
    tabBarVisible="true" textAlign="right" title="tipCalc">
    //// start of script section:
    <fx:Script>
            <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;
    // show a message box when button pressed
    protected function about_clickHandler(event:MouseEvent):void
                Alert.show( "This is a message!", "Dialog Title" );    }
    This results in the errors below:
    Access of undefined property Alert.
    Definition mx.controls:Alert could not be found.  

    Well, me and my three days of Flash Builder are lost in the woods. I have no idea how to do what you suggest. The code Google's showing me seems to call for scrapping my working functional program and starting from scratch. For a message box.
    Can I add a message box to my existing code?
    Here's the header...
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    actionBarVisible="true" fontWeight="normal" overlayControls="false"
    tabBarVisible="true" textAlign="right" title="tipCalc">
    And here's theclickHandler that should call the popup.
        protected function about_clickHandler(event:MouseEvent):void
                    //  Call a message box.

  • Trying to use Alert.show in module- possible?

    I have some user data that I have to validate before
    submitting it to a db and so I was planning on popping up an
    Alert.show to ask them if they are sure in the usual fashion.
    Button click event points to function that should show the Alert.
    debug shows that function gets entered, but Alert does not show. no
    error, just no Alert. code and controls are in a module that's
    loaded into main application based on user input. Is this the
    problem? Should I be using a popup window instead of Alert? Thanks
    in advance.
    Andy C.(never #)

    First, thanks for the reply:
    I can't browse outside from my windows box( well I can but
    they can see what I'm doing), so I can paraphrase.
    <mx:Button label="Add Button" id="btnAddUser"
    click="doAddUser(event)" />
    <mx:Script>
    <![CDATA[
    import mx.everything and its brother;
    private function doAddUser(event:Event):void
    var alrtmsg:String="Are you sure you want to add this data
    to the database?";
    var alrtttl:String="Confirm User Add";
    Alert.show(alrtmsg,alrtttl, Alert.YES | Alert.NO, this,
    alertClickHandler);
    private function alertClickHandler(event:CloseEvent):void
    if(event.detail==Alert.YES)
    rest of code does validation
    ]]>
    </mx:Script>
    This is pretty much straight out of the help screens. Now
    this is in a module that's loaded into the main application.
    Everything else works as I expect it to, but I can't get the Alert
    to popup. And obviously, since I'm validating user input I have to
    have a way to show them when they forgot to put something in.
    Thanks

  • How to pass parameter to function when confirm(Alert.show) closed?

    <![CDATA[
    import mx.controls.*;
    import mx.events.*;
    private function deleteItem(guid:String):void
    Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
    private function alertClicked(event:CloseEvent) {
    if(event.detail == Alert.YES) {
      Alert.show("yes "+guid); //<-- here I want to get guid
    else if (event.detail == Alert.NO){
      Alert.show("no ");
      return;
    ]]>
    Thanks.

    Hi Itambs,
    You can do the following:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="deleteItem('Dummy GUID VALUE')">
    <mx:Script>
      <![CDATA[
       import mx.controls.*;
       import mx.events.*;
       private var myAlert:Alert;
       private function deleteItem(guid:String):void
        myAlert = Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
        myAlert.data = guid;
        myAlert.height = 150;
                    myAlert.width = 300;
       private function alertClicked(event:CloseEvent):void{
        if(event.detail == Alert.YES) {
           //Alert.show("yes "+guid); //<-- here I want to get guid
           Alert.show("yes "+ myAlert.data);
        else if (event.detail == Alert.NO){
           Alert.show("no ");
           return;
      ]]>
    </mx:Script>
    </mx:Application>
    Note: you can also do this in another way by decalring a global variable guid as ...... private var _guid:String="";
    set _guid = guid; in deleteItem() function and then in alertClicked() function you can access the value as _guid again...which holds the saved value...
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • DragDrop Question With Alert.show

    Hi Everyone,
    I have some list controls which I have set the property dropEnabled="true".
    <mx:HBox label="SMR Vessels" height="220" width="100%" horizontalAlign="left" dropEnabled="true">
      <mx:List id="ls1" width="100%" height="100%" dropEnabled="true" dragDrop="ls1_dragDrop(event)"  >
      </mx:List>
      <mx:List id="ls2" width="100%" height="100%" dragEnabled="true" dragMoveEnabled="false"  >
       </mx:List>
    </mx:HBox>
    private function ls1_dragDrop(evt:DragEvent):void
      // Get the data from the dragEvent parameter.
      objDragSource = evt.dragSource.dataForFormat("items");
      //.... Do some things
      //Call an alert.show function to confirm from user if proceed.
      Alert.show('Proceed?', 'TITLE', Alert.YES | Alert.NO, null, alertHandler, null, Alert.YES);
      // Some scripts here...but these are executed right away even before the alert.show's button is clicked.
    When the alert message shows, the only recourse I have is to continue the operation in the alertHandler event.  But I how will I be able to reference the dragDrop event parameter from the alertHandler?
    I am banging my head the whole day on this.  Shouldn't it be that the script after the alert.show only continue once the alertHandler has finished executing its scripts.  But apparently, with Flex, that is not the case since it executes the script after the alert.show was called concurrently with the alerthandler.
    Inputs highly appreciated.
    Thanks.

    The alert handler is also declared in the same MXML file.
    <mx:HBox label="SMR Vessels" height="220" width="100%" horizontalAlign="left" dropEnabled="true">
      <mx:List id="ls1" width="100%" height="100%" dropEnabled="true" dragDrop="ls1_dragDrop(event)"  >
      </mx:List>
      <mx:List id="ls2" width="100%" height="100%" dragEnabled="true" dragMoveEnabled="false"  >
       </mx:List>
    </mx:HBox>
    private function ls1_dragDrop(evt:DragEvent):void
      // Get the data from the dragEvent parameter.
      objDragSource = evt.dragSource.dataForFormat("items");
      //.... Do some things
      //Call an alert.show function to confirm from user if proceed.
      Alert.show('Proceed?', 'TITLE', Alert.YES | Alert.NO, null, alertHandler, null, Alert.YES);
      // Some scripts here...but these are executed right away even before the alert.show's button is clicked.
    private function alertHandler(evt:CloseEvent):void
      if(evt.detail == Alert.YES)
        // Continue with the drag and drop processing here.
        // Take note that I need to reference the dragEvent parameter which was only visible in the ls1_dragDrop event.
      else
        // Here i should be calling the dragEvent's preventDefault function to prevent the drag and drop from happening since the user
        // does not confirm to proceed with the operation
    I tried to declare a application level scope variable, and set the value, but the scripts after the alert.show are executed right away without checking the values set in the alertHandler event.  Thus, I am getting incorrect execution.

  • Alert.show() interesting behaviour

    I use multiple SWFs loaded in one main SWF. Each SWF is form
    and its form is linked to a class that extends the form class.
    Most of the forms use a base class. The base class includes a
    prompt function that calls Alert.show(). The form class calls the
    prompt function and when used within the SWF itself it works as
    expected but when the SWF is loaded in a movieclip of the main SWF
    then the message becomes the title and the title becomes the
    message and everything else seems to be find.
    I cannot figure out what the fuddle doddle is going on.
    I know that some V2 components don't behaves as expected when
    used in a SWF loaded into another SWF such as the ComboBox
    component that requires a _lockroot to expand its list when clicked
    if it's SWF is loaded into another SWF.
    I suspect the same type of weirdness is going on with the
    Alert component. I do have the _lockroot set but no cigars.
    I also imported the mx.controls.Alert class in both, the base
    class and the form class with no success.
    Does anyone know how to make this work?
    Also, dos anyone knows of a list of SWF loaded into another
    SWF V2 component quirks and their solutions if any?

    I should add that if I use Alert.show() directly from the
    form class the it is working fine. It is only when I use it in a
    base class function such as 'prompt' called from the form class
    that it flips the message and title.

  • Alert.show on iphone

    Hi fellow packagers,
    is it possible to have an Alert.show()
    import mx.controls.Alert;
    Alert.show("message to show","name of window", Alert.YES | Alert.NO, null, close, null, 2);
    I'm getting a message that Alert is actionscript 2 only, never seen that one before!
    So is this correct. I have been reading a recently written book called "Beginning Air" and its in there
    so I'm confused.
    cheers
    KBN

    thanks matthew
    thats a great website.
    I was rather looking for a native "Alert" box in Air. There seems to be one but I cant make it work
    cheers
    KBN

  • Alert showing in invisible mode?

    Hello,
    I've created a popupmanager to display a panel,
    The thing is, that when i activate the pop up, and then activate an Alert.show, the alert is invisible.
    If for example I activate the alert first, the alert is visible. I dont know how is this happening.
    Any ideas?

    Does anyone has clue to this problem. Since system defined alert also not working in update mode, hence I need urgent attention from all users pls.
    Thanks
    OP Sharma

  • Monitoring Active Alerts shows critical heartbeat failure while server is working

    details of the alert shows the reason is the computer can't be reached through an ICMP ping
    if do a 
    ping servname
    it uses the IPV6  and fails
    Why isn't it using IPv4?
    thanks
    N
    NM

    Hi,
    In the Tasks pane, under Health Service Watcher Tasks, click
    Ping Computer. The task opens a dialog box to display its progress.
    In addition, more details, please read the article below to troubleshoot heartbeat failure issue:
    Resolving Heartbeat Alerts
    https://technet.microsoft.com/en-us/library/hh212891.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to center align Alert.show() in flex

    Hello All,
    I have a tall Flex application that uses Alert.show( ) to display error/warning messages. This created problems when the error messages were centered on the screen, but not visible when the screen was at an extreme scroll position (top or bottom). is there any way that i can display the Alert in the center of the user's viewable page. I've tried the following, but didn't work.
    var errorMsg:Alert = Alert.show("Error message"); PopUpManager.centerPopUp(errorMsg);
    Thanks in advance.

    Thanks for your help, yes by using some javascript calls i'm now able center align the Alert.
    Here is the solutions for my problem.
    var viewPoint:Number = ExternalInterface.call("eval", "window.pageYOffset"); var browserHeight:Number = ExternalInterface.call("eval", "window.innerHeight"); //the following calculation finds the center y coordinate in user's viewable page. var viewableY : Number = ((browserHeight/2)+viewPoint-50); var alert : Alert = Alert.show("Error Msg"); PopUpManager.centerPopUp(alert); alert.move(400,viewableY);
    I hope this helps someone...

  • RangeError inside mx.controls::Menu/show()

    This bug seems to happen only with submenus, when the mouse
    move quickly on another menu.
    the Hide/Show part of the MenuBar seems to be buggy.
    How to reproduce it ? this is not very clear. see in the end
    of this POST.
    RangeError: Error #2006: L'index indiqué sort des
    limites.
    at flash.display::DisplayObjectContainer/addChildAt()
    at mx.managers::SystemManager/
    http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()[C:\dev\GMC\sdk\framew orks\mx\managers\SystemManager.as:1578
    at
    mx.managers::SystemManager/addChild()[C:\dev\GMC\sdk\frameworks\mx\managers\SystemManager .as:1190]
    at
    mx.managers::PopUpManager$/addPopUp()[C:\dev\GMC\sdk\frameworks\mx\managers\PopUpManager. as:221]
    at
    mx.controls::Menu/show()[C:\dev\GMC\sdk\frameworks\mx\controls\Menu.as:1027]
    at
    mx.controls::MenuBar/mx.controls:MenuBar::showMenu()[C:\dev\GMC\sdk\frameworks\mx\control s\MenuBar.as:1350]
    at
    mx.controls::MenuBar/mx.controls:MenuBar::mouseOverHandler()[C:\dev\GMC\sdk\frameworks\mx \controls\MenuBar.as:1431]
    I build the MenuBar example in the offical Doc.
    <menuitem label="Menu1">
    <menuitem label="MenuItem 1-A" data="1A"/>
    <menuitem label="MenuItem 1-B" data="1B"/>
    </menuitem>
    <menuitem label="Menu2">
    <menuitem label="MenuItem 2-A" type="check"
    data="2A"/>
    <menuitem type="separator" />
    <menuitem label="MenuItem 2-B" >
    <menuitem label="SubMenuItem 3-A" type="radio"
    groupName="one" data="3A"/>
    <menuitem label="SubMenuItem 3-B" type="radio"
    groupName="one" data="3B"/>
    </menuitem>
    </menuitem>
    then I click on the menu to activate it.
    then I move the mouse quickly a circular way over the menubar
    the trick is to move over the "SubMenuItem 3-B" and go as
    fast as you can
    on the first menu: "Menu1"
    doing this will crash after 10 seconds (depend where the
    mouse move)
    it seems that the submenu is not properly closed, or its
    parent menu is dead before him...

    to be more precise, it is certainly related to SUBMENU.
    nothing happen with simple 1 level menu.
    so troubles should begin with items "SubMenuItem 3-A" and
    "SubMenuItem 3-B" when mouse
    move over them quickly to another menu, for example "Menu1"
    then go back to the parent of the
    submenu ("Menu2").
    show() crash to display "Menu2", may be because submenu is
    not properly closed.

Maybe you are looking for