0 Replies Latest reply on Oct 29, 2010 5:40 AM by VeyronSA

    docWindow.open(); Noob Help


      Hi All,


      New with the Flash Builder and have done some google`ing to check if someone had done this before, but i`m getting nowhere. So i would like some assistance with a error i have.


      I have created 2 mxml Appliction files, one is called "start" and the other "DocumentWindow". Using Flex 3.5 SDK.


      I want the "start" application to run as a pre-loader for the application set in "DocumentsWindow", the "start" application get the latest update from the server where hosted, after about 10 seconds then the application "start" should open the "DocumentsWindow" application. But I`m getting nowhere and i see that the following code is a problem but cant solve it:




      Here us the full app for "start.mxml"

      <?xml version="1.0" encoding="utf-8"?>

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"











           <mx:Image id="backgroundImage"











                     // Update Notice Function ////////////////////////////////////////////////

                     import air.update.ApplicationUpdaterUI;

                     import air.update.events.UpdateEvent;

                     import flash.events.ErrorEvent;

                     import mx.controls.Alert;


                     private var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();


                     private function checkUpdate():void {


                          appUpdater.updateURL = "http://urltoserver/update.xml";

                          appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);

                          appUpdater.addEventListener(ErrorEvent.ERROR, onError);

                          appUpdater.isCheckForUpdateVisible = false;

                          appUpdater.isFileUpdateVisible = false;

                          appUpdater.isInstallUpdateVisible = false;




                     private function onUpdate(event:UpdateEvent):void {





                     private function onError(event:ErrorEvent):void {




                     private function setApplicationVersion():void {

                          var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;

                          var ns:Namespace = appXML.namespace();

                          lblAppVersion.text = "" + appXML.ns::version;


                     // Launch Main.mxml Function /////////////////////////////////////////////

                     import myComponents.DocumentWindow;

                     private const LOAD_DELAY:int = 4;

                     private var timeElapsed:int = 0;

                     private var loadTimer:Timer;


                     private var docWindow:DocumentWindow;


                     private function init():void


                          // center the window on the screen

                          var screenBounds:Rectangle = Screen.mainScreen.bounds;

                          nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;

                          nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;


                          // start the timer, which simulates a loading delay

                          loadTimer = new Timer(1000);

                          loadTimer.addEventListener(TimerEvent.TIMER, incrementTime);






                     private function incrementTime(event:TimerEvent):void






                          // if the loading delay has passed, stop the timer,

                          // close the splash screen, and open the document window

                          if ((LOAD_DELAY - timeElapsed) == 0)



                               loadTimer.removeEventListener(TimerEvent.TIMER, incrementTime);

                               loadTimer = null;




                               // open a new instance of the document window

                               docWindow = new DocumentWindow();





                     private function updateStatus():void


                          var timeRemaining:uint = LOAD_DELAY - timeElapsed;

                          var timeRemainingMsg:String = timeRemaining.toString() + " second";

                          if (timeRemaining != 1) { timeRemainingMsg += "s"; }

                          timeRemainingMsg += " remaining.";




           <mx:VBox x="6" y="156">


           <mx:Label id="lblAppVersion" color="#CCCCCC" width="150" x="5" y="157"/>

           <mx:Label x="2" y="174"  color="#CCCCCC" text="Copyright © 2010 Company"/>




      Here is the full code for "DocumentsWindow"

      <?xml version="1.0" encoding="utf-8"?>

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"



           <mx:Label x="389" y="39" text="Document Window" width="112" height="20"/>



      Can someone please tell me what to do