5 Replies Latest reply on May 29, 2009 11:26 AM by Flex harUI

    SWFLoader pause or throttle

    meshgraphics Level 2

      I'm trying to load two swf files with swfloader class.  The small one loads and pauses while the second one finishes loading.  I'm trying to find a way to throttle the loading of the big file so it doesn't lock up the small movie.  I've looked at callLater but I dont think that will work.

       

      Anyone have any ideas?

        • 1. Re: SWFLoader pause or throttle
          Flex harUI Adobe Employee

          Are you trying this when loading over http or just from FlexBuilder.  When testing from FlexBuilder you are probably using file:// and the loading behavior may not be streamed so you can see different results

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: SWFLoader pause or throttle
            meshgraphics Level 2

            I've tried it in a Flex Project and an ActionScript Project. Simple use of the "source" attrib? would be http.

             

             

            The first time something like this is run, it loads from the network, of course.  Subsequent loads seems to use the browser cache but it still freezes the intro movie.

             

            I'm using Win XP.

             

            {{{update}}}

            The small movie loops. I haven't seen a property for that.  Normally loop is set in the web page object/embed.

             

            Ok.  It doesn't seem to be pausing on the loop.

            • 3. Re: SWFLoader pause or throttle
              Flex harUI Adobe Employee

              In the code sample below, http: is not specified so using FlexBuilder in either Flex Project or AS Project you should see file:// in the browser URL and the SWFs will not be streamed.  Copy the bin-debug or bin-release folders to a server and try it again.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui

              • 4. Re: SWFLoader pause or throttle
                meshgraphics Level 2

                My projects publish to a local web server.  The default access method for the source property and the load method is http.  Otherwise they wouldn't work on a web server.  Unless flash can read files on an http server by a method other than http?  Not likely.  file:/// might even be considered http.

                 

                Anyways that's not the issue.

                 

                The issue is that a master swf is loading 2 children swf.  The swf that loads first will not play smoothly while the other swf is loading.

                 

                The question is: Can I get smooth animation while an swf is loading?

                 

                • 5. Re: SWFLoader pause or throttle
                  Flex harUI Adobe Employee

                  If the URL in the browser says http:  then all subsequent loading of relative paths is via http.

                   

                  I would run some tests to make sure it is the streaming and not the initializing of the second SWF that is the problem.

                  First, don't load the second SWF and examine things like CPU and frame intervals (trace(getTimer() on enterFrame).  That will give you an idea of how much bandwidth is left.  Is the first SWF doing some really serious animation?

                   

                  Second, instead of loading the second SWF, do some work on enterFrame like a loop to see if simple CPU degradation is what is affecting the animation.

                   

                  Third, make a really huge SWF.  Embed some videos and what not so the second SWF download time will be many seconds and see if it is the downloading that is the problem. 

                   

                  What is in the second swf?  If it is frame-based then maybe it isn't the streaming but rather its per-frame actions that are the problem.

                   

                  Alex Harui

                  Flex SDK Developer

                  Adobe Systems Inc.

                  Blog: http://blogs.adobe.com/aharui