4 Replies Latest reply on Jun 21, 2010 5:54 AM by RedLine_24_12

    stop loading the flash file - let it load only to a certain frame and then stop

    RedLine_24_12

      hi,

       

      have a problem with a flash page i am designing ..

       

      i want the .SWF file to be opened but not donwloaded until a button is pressed but don't know ho to do that..

       

      i will be more precise:

       

      on frame 1 i have an object (movieclip) that consists of a logo with a blur effect.. after 1-2 seconds the blur effect goes away and you can see the logo. the logo itself is a button that send's the user to the next frame in the main scene.

       

      on frame 2 of the main scene i have a preloader that shows the percentage of the loaded page and a progress bar .. everything works great

       

      the problem is that when you open the swf it starts downloading the hole flash site and when you press enter the site is already loaded and you can't see the progress bar of the preloader..

       

      i want only the 1 frame of the main scene to be loded, then i want i to stop loading (downloading) the SWF file until enter is pressed.

      when enter is pressed i want the flash site to be loaded and so you can see the preloader in action..

       

       

      can i put some code on the action layer on the 1 frame that stops loading the movie (the first frame is loaded and the blur effect of the logo plays). and another code on the second frame (where the preloader is visible) that starts the donwloading again?

       

       

      thanks a lot for the help!

        • 1. Re: stop loading the flash file - let it load only to a certain frame and then stop
          Booya2nd

          Hi RedLine,

           

          I don't think that it is possible to just display a certain frame and pause loading ...

          (well I actuallay don't know if this could maybe be accomplished with flash.net.URLStream and flash.utils.ByteArray)

           

          I guess you will have to get your enter button and preloader into one swf  and your application into another one.

           

          So you first load button + preloader.

          After the user clicked your enter button the preloader invokes a  flash.display.Loader.load()  to get your application.

           

          Hope this helps.

          1 person found this helpful
          • 2. Re: stop loading the flash file - let it load only to a certain frame and then stop
            RedLine_24_12 Level 1

            hi, thanks for your help!

             

            ok .. the thing you said makes sense for me ..

             

            now i have another problem .. i am not an advanced flash programmer and don't know how to load the actual "flash site" from the other swf file where the button and the loader are ..

             

            will i have 2 swf files?

             

            how can i open the second swf file from the first ..

             

            i think i will make a swf with the logo and it's animation and then load a second swf that starts with the loader and then the site ..

             

            will the page in the browser refresh if i load the second swf file from the firs one ?

             

            thanks a lot!

            • 3. Re: stop loading the flash file - let it load only to a certain frame and then stop
              Booya2nd Level 2

              Hi,

               

              you are correct you will end up with two swf  files.
              I hope you are on Actionscript 3.0:

               

               

              ...
              
              enterButton_btn.addEventListener(MouseEvent.CLICK, loadMyApp)
              
              ....
              
              function loadMyApp(e:Event=null):void {
                   var ldr:Loader = new Loader();
                   ldr.contentLoader.addEventListener(Event.COMPLETE, onComplete);
                   ldr.contentLoader.addEventListener(ErrorEvent.IO_ERROR, onError);
                   ldr.contentLaoder.addEventListener(ProgressEvent.PROGRESS, onProgress)
                   ldr.load(URLRequest('mysite.swf'));
              }
              
              function onProgress(e:ProgressEvent):void{
                   trace(e.bytesTotal/e.bytesLoaded * 100 +'% loaded');
              }
              
              function onError(e:ErrorEvent):void{
                   trace('Ooops something went wrong: '+e.text)
              }
              
              function onComplete(e:Event):void{
                   addChild(e.currentTarget.content);
              }
              

               

              Have a look into the adobe reference  http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/

               

              Regards,

              Booya

              • 4. Re: stop loading the flash file - let it load only to a certain frame and then stop
                RedLine_24_12 Level 1

                thanks a lot for the help ..

                 

                unfortunatly i'm not in AS3 but in AS2 ..

                 

                but no worry .. i managed to do what i wanted just 1 minute ago :

                 

                 

                i created an empy movieclip in the second frame of the first swf file (where there is only the enter button) and scripted it with:

                 

                onClipEvent (load) {
                    loadMovie("name of second swf file.swf", "_parent");
                }

                everything works fine now .. except that now my sound will not work corectly .. but i will fix that ..

                 

                in the site i added a script that loads an external .mp3 file on frame 2 .. it works fine but if i start the swf with "download simulation" on (so i can see the preloader in action) then the sound will not start .. wehn i only test the movie without download simulation the sound works .. don't know why ..

                 

                thanks for your help .. i appreciated it a lot ..

                 

                bye!