2 Replies Latest reply on Jun 15, 2009 10:23 AM by rvollmar

    Alert popup window isn't always centered

    dgassner

      OK, this is really specific:

       

      In the application below, I'm calling Alert.show() from an itemClick event handler that's triggered from a PopUpMenuButton control. When the user clicks the button, the Alert popup is centered on the screen as expected. When the user selects an item from the control's popup button, the Alert popup is displayed in the top left corner of the application instead of the application's center.

       

      Here it is....

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/halo">
        <fx:Script>
        <![CDATA[
          import mx.controls.Alert;
          import mx.events.MenuEvent;
         
          private function itemClickHandler(event:MenuEvent):void
          {
            Alert.show("Menu label: " + event.item.@label,
              "Menu value: " + event.item.@value);
          }
         ]]>
        </fx:Script>
        <fx:Declarations>
          <fx:XMLList id="xSizes">
            <node label="Small" value="S"/>
            <node label="Medium" value="M"/>
            <node label="Large" value="L"/>
          </fx:XMLList>
        </fx:Declarations>
        <s:Panel title="PopUpMenuButton Demo"
          horizontalCenter="0" top="20">
          <s:layout>
            <s:HorizontalLayout
              paddingTop="10" paddingLeft="10"
              paddingRight="10" paddingBottom="10"/>
          </s:layout>
          <s:SimpleText text="Select a size:"/>
          <mx:PopUpMenuButton id="p2"
            dataProvider="{xSizes}"
            labelField="@label"
            itemClick="itemClickHandler(event);"/>
        </s:Panel>

      </s:Application>