5 Replies Latest reply: Apr 24, 2013 1:55 PM by kglad RSS

    Preloader Not Working Properly


      I know, another Preloader post. I was asked to problem solve why a preloader sometimes shows up, but mostly doesn't, leaving the viewer confused as to why they are staring at a blank page for a long time, waiting for something to happen. Problem is, I am not very knowledgable in flash.


      Below is the code I was asked to work with.The client wanted the entire site to preload; opening animation and videos throughout the site. My boss actually ended up piecing this code together, but is also not a flash guru, so he is out of ideas.


      I don't really know what the issue is, and most of the tutorials I looked up deal with a different code.



      stop(); var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); var videoPlayer:Video = new Video(); videoPlayer.attachNetStream(ns) ns.play("http://www.missionpublicaffairs.com/MPA-031813.flv"); ns.pause(); var SWFtotal:int; var VIDEOtotal: int; var AVGtotal: int; function checkLoad():void { trace("Video Bytes Loaded: " + ns.bytesLoaded); trace("SWF Bytes Loaded: " + this.stage.loaderInfo.bytesLoaded); SWFtotal = int(((this.stage.loaderInfo.bytesLoaded/this.stage.loaderInfo.bytesTotal)*100)); VIDEOtotal = int(((ns.bytesLoaded/ns.bytesTotal)*100)); AVGtotal = int(((SWFtotal + VIDEOtotal)/2)) //MattText.text = "Video Loaded: " + VIDEOtotal + "%"; //SWFText.text = "SWF Bytes Loaded: " + SWFtotal + "%"; TotalText.text = "Total Loaded: " + AVGtotal + "%";           if ((ns.bytesLoaded == ns.bytesTotal) && (this.stage.loaderInfo.bytesLoaded == this.stage.loaderInfo.bytesTotal)) {           clearInterval(myInterval);           this.gotoAndPlay(2); } } var myInterval:uint = setInterval (checkLoad, 200);


      The site link is here, if needed. Again, sometimes it shows, sometimes not. Please let me know if you need anything answered in order to give me pointers. Thanks in advance.