0 Replies Latest reply on Sep 27, 2010 6:47 AM by smon_ed

    Flex AIR 2.0 centred application has an uncentred Alert control

    smon_ed Level 1
      <?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"
              backgroundColor="#000000"
              applicationComplete="appStartup()" 
              width="1024" height="768"
              showStatusBar="false">
       
       
       <fx:Script>
        <![CDATA[
         import mx.controls.Alert;
         
         public function appStartup():void
         {
          stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
          stage.scaleMode = StageScaleMode.NO_SCALE;
          stage.align = "";
          
          
          
          var myAlert:Alert;
          myAlert = Alert.show("This is my Alert control.", "ALERT!", Alert.OK);
          myAlert.width = 300;
          myAlert.height = 150;
          
         }
        ]]>
       </fx:Script>
       
       
       <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
       </fx:Declarations>
       
       <s:Rect width="1024" height="768">                              
        <s:fill>
         <s:SolidColor color="#0000FF"/>
        </s:fill>
       </s:Rect>
       
       
      </s:WindowedApplication>
      

       

      I am setting my application to full screen, with no scaling.

       

      My application is 1024x768 and on a screen that is, for example, 1280x1024, I need to centre the application to the user's screen.

       

      I do this by using align="" which is the only way I found to achieve this.

       

      But when I show an Alert box, the Alert is aligned to the top-left of the application and not the top-left of the screen.

       

      I'll post an image if that's not so clear.

       

      Any tips on how to get the Alert centred to the screen?

       

      alert.jpg