6 Replies Latest reply: Sep 2, 2012 8:37 PM by rahimhaji RSS

    Load multiple swf play one by one when required

    rahimhaji Community Member

      Dear Friends,

       

      i want to Load multiple swf play one by one when required, i mean, i want to reduce the loading time, so i cut my swf in to 2 portion, load both same time or load 2nd while 1st one playing and how can i show the 2nd one when first one finished?

       

      Thanks in advance,

       

      Regards,

      Syed Abdul Rahim

        • 1. Re: Load multiple swf play one by one when required
          Ned Murphy CommunityMVP

          You need to either have something in the first trigger the start of the second when it completes, or you need something external that is capable of monitoring the first to see when it completes so that it can trigger the second to start.  The design/code you currently have will help to determine which is the more likely way for you to proceed.

          • 2. Re: Load multiple swf play one by one when required
            rahimhaji Community Member

            Dear Mr.Nedmurphy,

             

            Thks for ur reply. I need to load both swf same time, when one get finished other one has to play immediately. My aim is to reduce the loading time, if i load 2nd one after first one finish viewer has to wait till it load, so i want to load 2nd one while first one playing, and play the 2nd one when 1st one finish.

             

            Thanks in advance,

             

            Syed Abdul Rahim

            • 3. Re: Load multiple swf play one by one when required
              Ned Murphy CommunityMVP

              Loading time is loading time, and you cannot reduce how long it takes.  It is not clear where you are having trouble.  Are you able to load the second file while the first is playing? Are you able to detect when the first has stopped playing?  Are you able to start the second swf playing when you need it to play?

              • 4. Re: Load multiple swf play one by one when required
                Amit Shakya Community Member

                see i write code for you may be it will helps you

                 

                var vidno:int=1

                var totalvideos:int=10

                 

                var ld:loader

                 

                 

                function loadvideo(str:String)

                addChild(ld)

                loader.load(urlrequest(str))

                loader.contentLoaderInfo.addEventListener(Event.Complete,loadnext)

                 

                function loadnext(event:Event):void{

                removeChild(ld)

                 

                if(vidno<totalvideos){

                    vidno++

                     loadvideo('vid'+vidno+'.swf')

                }

                }

                 

                loadvideo(vid1.swf)

                 

                try it..

                • 5. Re: Load multiple swf play one by one when required
                  Ned Murphy CommunityMVP

                  You should rewrite that code, correctly, so that it makes sense.  It is very difficult to help someone with code if they are not showing the code they are actually using, and if you are actually using the code you showed, you should have errors.  You have a Loader named 'ld' that does nothing - not an error, but it serves no purpose.  You have a class and function that do not exist as far as I know (loader, urlrequest)

                  • 6. Re: Load multiple swf play one by one when required
                    rahimhaji Community Member

                    Thks Mr.Ned murphy,

                     

                    i found the solution, what i did was, i loaded 2 different swf with 2 different loaders. i stoped playing second loaded swf by MovieClip(loder.content).gotoAndStop(1)

                     

                    Thks & Regards,

                     

                    Syed Abdul Rahim