1 Reply Latest reply on Sep 17, 2010 3:50 PM by Flex harUI

    SWFLoader causing a re-draw of parent application's background

    fatima.m

      Hi,

       

      I have an application that has a menuBar in it. When a menu item is selected from the menuBar, a SWFLoader is supposed to load the specified URL

      Everytime a new URL gets loaded to the SWFLoader, an unloadAndStop takes place then the new one is then loaded.

       

       

       

      public static function createSWFLoader():SWFLoader

      {

       

         var loaderContext:LoaderContext = new LoaderContext();

         loaderContext.securityDomain = SecurityDomain.currentDomain;

       

         loaderContext.applicationDomain = ApplicationDomain.currentDomain;

       

       

       

         var swfLoader:SWFLoader = new SWFLoader();

         swfLoader.autoLoad =

      true;

        swfLoader.loaderContext = loaderContext;

         swfLoader.percentHeight = 100;

         swfLoader.percentWidth = 100;

         swfLoader.cachePolicy = UIComponentCachePolicy.OFF;

       

       

         return swfLoader;

      }

       

       

       

       

      public static function unloadSWFLoader(swfLoader:SWFLoader):void

      {

       

       

       

         var loaderContext:LoaderContext = new LoaderContext();

         loaderContext.securityDomain = SecurityDomain.currentDomain;

       

         loaderContext.applicationDomain = ApplicationDomain.currentDomain;

       

       

         var swfLoader:SWFLoader = new SWFLoader();

         swfLoader.autoLoad =

      true;

         swfLoader.loaderContext = loaderContext;

         swfLoader.percentHeight = 100;

         swfLoader.percentWidth = 100;

         swfLoader.cachePolicy = UIComponentCachePolicy.OFF;

       

       

         return swfLoader;

      }

       

       

       

       

       

      public static function loadSWFLoader(

      swfLoader:SWFLoader, height, width,

      url:String,

      parentContainer):

      void

      {

           swfLoader.height = height;

           swfLoader.width = width;

           parentContainer.width = width;

           parentContainer.height = height;

      }

       

      So the applicaiton calls createSWFLoader followed by unloadSWFLoader then loadSWFLoader. Unfortunatelly, after it is done loading, a re-draw of the main applicaition's background seems to happen, so the user sees a flicker in the screen. I am not sure why this is happening. Any ideas are greatly appreciated.

      Thank you.