0 Replies Latest reply on Jul 8, 2010 5:52 PM by sanggpark

    Opening window behind another one

    sanggpark

      I'm trying to open a new window behind the current one and I can't seem to figure out how.

      Here's an example.

      <?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"
                                  creationComplete="onCreationComplete(event)">
           
           <fx:Script>
                <![CDATA[
                     import mx.events.FlexEvent;
                     
                     import spark.components.Window;
                     
                     private var window1:Window     = new Window();
                     private var window2:Window     = new Window();
                     private var timer:Timer      = new Timer(3000,1);
                     
                     private function onCreationComplete(event:FlexEvent):void
                     {
                          window1           = new Window();
                          window1.title      = "Window 1";
                          window1.width      = 200;
                          window1.height      = 200;
                          window1.open(false);
                          window1.orderInBackOf(this);
                          
                          window2           = new Window();
                          window2.title      = "Window 2";
                          window2.width     = 200;
                          window2.height     = 200;
                          
                          timer.addEventListener(TimerEvent.TIMER_COMPLETE, openWindow2, false, 0, true);
                          timer.start();               
                     }
                     
                     private function openWindow2(event:TimerEvent):void
                     {
                          window2.open(false);     
                          window2.orderInBackOf(window1);
                     }
                ]]>
           </fx:Script>
      </s:WindowedApplication>
      
      
      

       

      My expectation of the above code is that window1 will open behind the main app and window2 will open behind window1. But instead window1 will open on top of the main app and window2 will open on top of the main app with the main app still in focus. Is this a bug in the system? or am I doing something wrong? Is there a fix/workaround for this?

       

      Thanks