4 Replies Latest reply on Feb 13, 2011 11:48 PM by moccamaximum

    Flash Pre-Loader issue

    jamesmoreira

      I made a flash pre loader before a swf video and it works fine when I run it locally but when I put it on a firefox browser from my hosting site, the pre loader doesn't stop when the video begins.....

       

      Has anyone ever come across this issue? here's my code...I used the template pre loader from flash...not the swf pre loader but the file pre loader....


      var contentLoader:Loader;
      loadContent("FLVPlayer_Progressive100.swf");
       
      function loadContent(url:String):void {
          contentLoader = new Loader();
          contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
          contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
          contentLoader.load(new URLRequest(url));
      }
       
      function contentLoaded(evt:Event):void {
          //Optionally change to a clip holder and set progressbar visibility.
          addChild(contentLoader);
      }

       

      function loading(evt:ProgressEvent):void {
          var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
         
      }

       

      function setBarProgress(value:Number) {
          progressbar.bar.scaleX = value;
      }

       

      Could it be that the firefox is just an old version? Is there a way to re write it so that the loader works across all browsers?

       

      Please Help! Thanks


        • 1. Re: Flash Pre-Loader issue
          moccamaximum Level 5

          upload the FLVPlayer_Progressive100.swf to your server and test your main file with an absolute path.

           

          alter this line:

          loadContent("FLVPlayer_Progressive100.swf") to sth. like

          loadContent("http://pathtoyourfile.com/FLVPlayer_Progressive100.swf");

           

          should give you output where the problem lies

           

          There is also one line missing in your code:

          in the loading function you don`t use the resulting percentage to feed the setProgressBar()

          1 person found this helpful
          • 2. Re: Flash Pre-Loader issue
            Ned Murphy Adobe Community Professional & MVP

            That code appears to be incomplete.  I see nothing that would provide any indication that the loading is in progress (nothing calls the setBarProgress function), nor is there anything that detects when loading is complete such that an indicators would be removed.

            • 3. Re: Flash Pre-Loader issue
              jamesmoreira Level 1

              Still no luck...it's weird because it works locally...but the preloader is still loading while the movie is playing.

               

              I think I did what you suggested....here's the actionscript code of the Flash swf I made for the pre loader.

               


              var contentLoader:Loader;
              loadContent("http://www.bridgemade.com/FLVPlayer_Progressive100.swf");
               
              function loadContent(url:String):void {
                  contentLoader = new Loader();
                  contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
                  contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
                  contentLoader.load(new URLRequest(url));
              }
               
              function contentLoaded(evt:Event):void {
                  //Optionally change to a clip holder and set progressbar visibility.
                  addChild(contentLoader);
              }
               
              function loading(evt:ProgressEvent):void {
                  var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
                  setBarProgress(loaded);
              }

               

              function setBarProgress(value:Number) {
                  progressbar.bar.scaleX = value;
              }

               

              I also tried it without the  "path to file" thing. Is there a stop function I can input? I'm working on a guy's website...if you want to actually check out my code the website is www.bridgemade.com/indexdream.

               

              The way I'm inputting the code for the pre loader swf I made is by replacing the file name....FLVPlayer_Progressive.swf (which is the original flash video which is around 3 minutes long) as the preloader flash swf I make and then renaming the original flash swf as FLVPlayer_Progressive100.swf.

               

              I did that in dreamweaver so that the files switched places...I'm not sure this has anything to do with why it's not working, but since the files are in the root folder I assumed it wouldn't...

               

              Please help! Thanks for responding before!

               

               


               

              .

              • 4. Re: Flash Pre-Loader issue
                moccamaximum Level 5

                I`m not sure if I understand you right. You`re original file was  a video (hence the flv_player...prefix? Did you make sure that there is no flvplayer component left that somehow checks for a video? in the component inspector you will maybe find a path to an flv file that is not there anymore. Another thing the progressbar to use to show the progress of your preloading won`t vanish magically, you have to declare sth. like

                removeChild(progressbar) to make it go away