8 Replies Latest reply on Sep 15, 2010 9:38 AM by getArchana

    [Unload SWF] - Automatically unloading a swf while loading - GC issue?

    vpflex

      Hi, I am trying to load a few style SWFs at runtime using the StyleManager.loadStyleDeclarations. There are more than 4 style SWFs and I load them through a for loop and add the IEventDispatcher to an array as a reference.. The files seem to load properly. But some times, some of the style SWFs are automatically unloaded . I see the [unload SWF] in the log... I am not sure how to avoid the files being GCed at the time of loading... Also it seems like they are being loaded/ decompressed twice. Please see the log below...

       

      [SWF] /Flex/com/../styles/Common.swf - 45,421 bytes after decompression

      [SWF] /Flex/com/../styles/StyleSkin.swf - 253,886 bytes after decompression

      [SWF] /Flex/com/../styles/StyleSkin_Fonts.swf - 440,292 bytes after decompression

      [SWF] /Flex/com/../styles/ StyleSkin _Assets.swf - 189,281 bytes after decompression

       

      [SWF] /Flex/com/../styles/ StyleSkin _Assets.swf - 1,153,335 bytes after decompression

      [SWF] /Flex/com/../styles/ Common.swf - 1,153,335 bytes after decompression

      [SWF] /Flex/com/../styles/ StyleSkin _Fonts.swf - 1,153,335 bytes after decompression

      [SWF] /Flex/com/../styles/ StyleSkin.swf - 1,153,335 bytes after decompression

       

      [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/StyleSkin_Assets.swf

      [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/Common.swf

      [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/StyleSkin _Fonts.swf

       

      How can avoid the files being GCed. is it because I  re use a single Loader (loadStyleDeclaration) to load multiple files?

        • 1. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
          Flex harUI Adobe Employee

          They are being loaded twice so the second copy goes away.  Are you saying

          that the first copy goes away too?

           

          It would be more efficient to not load them twice so see if you can figure

          out why there are two loads.

          • 2. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
            vpflex Level 1

            Both the copies go away.. and I don't load them twice , only once through a loop and when i debug and see the for loop below is executed only once... Am I not doing it the right way? . I am failry new to Flex and I couldn't find why Flex loads it twice

             

            This is how try to load them in the application...

             

            for

             

             

            (var index:uint = 0; index < styleSheetFiles.length; index++)

            {

            styleSheetsLoaded[index] =

            false;

             

             

            // Load the stylesheet files

             

             

            var styleSheetFileFullPath:String = STYLESHEET_FILE_BASE_PATH + (styleSheetFiles[index] as String);

            eventDispatchers[index] = StyleManager.loadStyleDeclarations(styleSheetFileFullPath)

            as IEventDispatcher;

             

            trace("loading: index" + index + " file:" + styleSheetFileFullPath);

             

            // It doesn't matter whether the result is complete or error

            (eventDispatchers[index]

            as IEventDispatcher).addEventListener(StyleEvent.COMPLETE, styleSheetFileLoaded);

            (eventDispatchers[index]

            as IEventDispatcher).addEventListener(StyleEvent.ERROR, styleSheetFileFailed);

            }

             

            In the complete event I try to trace that the particular file has been loaded to see whether it has been loaded... But i don''t see it there...

            • 3. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
              Darrell Loverin Level 4

              I think was you are seeing as the second load is an RSL. This is a know issue with the debug output. Try compiling your style swfs with -static-rsls=false.

               

              Notice the size is the same of the "second" load of the style swf. It is the same for the three swfs:

              /Flex/com/../styles/ StyleSkin _Assets.swf - 1,153,335 bytes after decompression

               

              /Flex/com/../styles/ Common.swf - 1,153,335 bytes after decompression

               

              /Flex/com/../styles/ StyleSkin _Fonts.swf - 1,153,335 bytes after decompression

               

              /Flex/com/../styles/ StyleSkin.swf - 1,153,335 bytes after decompression

               

               

              The RSLs are unloaded by the Flash Player because they have already loaded.

               

               

               

              -Darrell

              1 person found this helpful
              • 4. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
                vpflex Level 1

                Thanks for the response.. But I am still having the same issue . This is how I compile my style swfs..

                 

                mxmlc StyleSkin.css -static-rsls=false -compiler.optimize=true -compiler.context-root=/Web -compiler.services=..\config\app-config.xml -library-path+=..\Flex\libs,..\Flex\libs\frameworks\libs -output StyleSkin.swf

                 

                I see that they are being loaded twice again. I tried compiling all the modules and everything with -static-rsls=false. But I still see that the files are loaded twice and it is unloaded... All my swfs are loaded twice, I don't know why

                 

                [SWF] /flex/com/

                ../styles/StyleSkin_Fonts.swf - 58,293 bytes after decompression

                [SWF] /flex/com/

                ../styles/Common.swf - 39,617 bytes after decompression

                [SWF] /flex/com/

                ../styles/StyleSkin_Assets.swf - 183,482 bytes after decompression

                [SWF] /flex/com/

                ../styles/StyleSkin.swf - 210,114 bytes after decompression

                [SWF] /flex/com/

                ../styles/StyleSkin_Fonts.swf - 1,153,335 bytes after decompression

                [SWF] /flex/com/

                ../styles/StyleSkin.swf - 1,153,335 bytes after decompression

                [SWF] /flex/com/

                ../styles/Common.swf - 1,153,335 bytes after decompression

                [SWF] /flex/com/

                ../styles/StyleSkin_Assets.swf - 1,153,335 bytes after decompression

                [Unload SWF] /flex/com/marketlinx/mls/client/ui/styles/

                StyleSkin_Fonts.swf

                • 5. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
                  Darrell Loverin Level 4

                  Sorry, my bad on the last response. I meant to say -static-rsls=true.

                   

                   

                  -Darrell

                  • 7. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
                    getArchana

                    Could you please tell me how was this problem solved? I am also getting the same problem and I am unable

                    to fix it

                    • 8. Re: [Unload SWF] - Automatically unloading a swf while loading - GC issue?
                      getArchana Level 1

                      I do not find code where I am loading the swf twice

                      but can see the log of [Unload swf]