0 Replies Latest reply on Feb 14, 2012 11:56 AM by nfallon55

    Popup Dialog popping up when app starts instead of when button pushed

    nfallon55 Level 1

      I have created a popup window that activates when a button is clicked.  For some reason the window is appearing when the application starts.  Here is the code for the popup window.

       

      <fx:Script>
      <![CDATA[
      import mx.events.FlexEvent;
      import mx.core.IFlexDisplayObject;
      import mx.events.CloseEvent;
      import mx.managers.PopUpManager;
      import spark.components.TitleWindow;
      protected var ttlWndw:TitleWindow;
      protected function button1_creationCompleteHandler(event:FlexEvent):void
      {
      ttlWndw = new TitleWindow();
      ttlWndw.title = "Spark TitleWindow title";
      ttlWndw.width = 300;
      ttlWndw.height = 200;
      ttlWndw.addEventListener(CloseEvent.CLOSE, ttlWndw_close);
      PopUpManager.addPopUp(ttlWndw, this, true);
      PopUpManager.centerPopUp(ttlWndw);
      }
      protected function ttlWndw_close(evt:CloseEvent):void {
      PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);
      }
      ]]>
      </fx:Script>

       

       

      Neil