0 Replies Latest reply: Apr 4, 2010 8:34 AM by feldin RSS

    flex 4 preloader problem with air

    feldin Community Member

      Hello,

       

      I was trying to delay the preloader just to do some other things before the application fully starts.. Anyway I used this code for my preloader:

      package com.somePackage
      
      {
      
          import flash.events.Event;
          import mx.preloaders.SparkDownloadProgressBar;
      
          public class Preloader extends SparkDownloadProgressBar
          {
              public function Preloader()
              {
                  super();
              }
              override protected function createChildren():void
              {
              }        
              override protected function setDownloadProgress(completed:Number, total:Number):void
              {
              }
              override protected function setInitProgress(completed:Number,total:Number):void
              {
              }
              override protected function initCompleteHandler(event:Event):void
              {
                  dispatchEvent(new Event(Event.COMPLETE));
              }
          }
      }
      

       

       

      this works but the problem is if i comment the line where i dispatch the complete event ( works on non-air project ) so that the preloader just stays instead of opening the application i get this error in air application:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at spark.components::WindowedApplication/enterFrameHandler()[E:\dev\4.0.0\frameworks\project s\airspark\src\spark\components\WindowedApplication.as:2350]

       

      I would just like to halt the preloader for few moments after the application fully loads to do some other stuff...
      any ideas?

       

      P.S. for the application I am using <s:WindowedApplication...