[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Preloader Question Again!

I'm creating a preloader for another flash project and I've slightly rewritten it since the last time I've used it. Basically, I've got a series of .swfs that I'm swapping in and out and I want to have a preloader function on the root so that each time I load a new swf, the preloader can run until the .swf is completely loaded. I've got 2 movie clips: loader_mc, which holds the preloader, and container_mc, which holds the actual movie I'm trying to load. I'm trying to hold container_mc and not run it until it's 50% loaded and then set it off (I've got a stop() action in frame 1 of all the external swfs so they won't start playing unless I explictly say so.) The problem is that I'm comparing the bytesLoaded against  the TotalByes and the totalBytes I'm getting is a completely erronous number. My first swf, for example is 980K, but it the number I'm getting for getBytesTotal is 12.

Here's my preLoader function - it resides on the main timeline of the movie that holds both the preloader movie clip and the container movie clip. Can anyone suggest what it might be that I'm doing wrong?


preLoader=function(movieNam) {
      this.attachMovie("mvclp-preloaderclip","loader_mc",9999);
      this.loader_mc._x=294;
      this.loader_mc._y=223;
      trace("movieNam is " + movieNam);
      this.container_mc.loadMovie(movieNam);
      
      this.loader_mc.onEnterFrame = function () {
            trace("entered frame...");
            bytesLoadedOutput = _root.container_mc.getBytesLoaded();
            bytesTotalOutput = _root.container_mc.getBytesTotal();
            amtLoaded = Math.round((bytesLoadedOutput / bytesTotalOutput) * 100);

            trace("and right now...");
            trace("bytesLoadedOutput is " + bytesLoadedOutput);
            trace("bytesTotalOutput is " + bytesTotalOutput);
            trace("amtLoaded is " + amtLoaded);
            

                  
            if (amtLoaded >= 100)
            {
                  
                  trace("they do equal each other");
                  this._visible = false;
                  _root.container_mc.play();
0
katyjack30096
Asked:
katyjack30096
  • 4
  • 3
1 Solution
 
BillystyxCommented:
If you are loading a clip that has a lot of mcs attached from the library, and you have the export on first frame checked in the linkage identifier, this will happen.
What you can do is uncheck that box, and add a junk frame to your swf (that noone will see), and add all the clips attached with attachMovie to that.
Then the preloader will know the actual total bytes in the movie and sort out the totalbytes and loadedbytes accordingly
billystyx
0
 
katyjack30096Author Commented:
I'm not quite sure I'm following you - I've got a main movie, a sub-movie I'm loading in via loadMovie, and a preloader clip that I'm attaching with attachMovie. The only movie clip I'm attaching is the preloader and it is really small and doesn't have any nested movie clips. The sub-movie I'm loading in does have a lot of movie clips, but I'm not attaching any of those and I'm not attaching the submovie, I'm loading it in using LoadMovie. So I don't have the linkage identifier checked for it since I'm not attaching it and it's the submovie that I'm having problems with. So, under those circumstances, can you offer me some advice?

Thanks -
0
 
BillystyxCommented:
Inside the submovie (which you are loading in), are there movieclips which you use attachMovie (inside that submovie) to attach to the root (of that submovie)?

I would suggest using the moviecliploader class to deal with this. (Or if the submovie has a lot of mcs attached dynamically, then add a junk frame to that swf (tyhe submovie)
hvae a look at http://www.billystyx.co.uk/setups/fla8.zip

billystyx
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
katyjack30096Author Commented:
I don't have any movie clips that I'm attaching, but I do have 2 wav files that I'm attaching to 2 sound objects - could that cause the same problem? I don't think I can use the moviecliploader class - isn't that only supported by player 7? One of my requirements is that I support player 6 and above. I'll try what you're talking about on the submovie and see if it helps.

Thanks -
0
 
BillystyxCommented:
yes, definitely - especially because they can be quite large -  and yes, only for flash player 7 (so I guess not flash mx:(

just drag the sounds directly to the timeline (_root timeline), but somewhere where you won't hear them ever!

Billystyx
0
 
katyjack30096Author Commented:
That did it - I actually kept the sounds in each submovie just to keep things better organized for my sake, but I put them in a separate movie clip that I don't refer to and didn't load them on the the 1st frame. Thanks for your help.
0
 
BillystyxCommented:
no worries:)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now