Things that never work for me

So I’ve read in many places that if a LoadMovie command (whatever) is used to load an external swf, then getBytesLoaded etc can also be used to determine the download progress of that .swf

How so?

Yes I can manage preloading an entire site but I need a little instruction in the fine art of preloading modules if you will.

If I placed the following code in the keyframe into which I want to load an external movie, would it work.

_root.createEmptyMovieClip(“container”,1)
loadMovie(“jellyfish.swf”,“container”)
if(_root[“jellyfish.swf”].getBytesLoaded>=(_root[“jellyfish.swf”].getBytesTotsl){
_root.play();
}

Would code be better placed in the first frame of the external movie with the mc itself on frame 2 or 3?

I have no feel for this one. It seems logical to monitor progress from within the main movie but something tells me that code should go in the external movie instead. It’s only that I read that if you use LoadMovie the getBytes etc can also be used. I’d like to see this in action.

Cheers

Well… what will happen in your example would be…

an empty movie clip is created
loadMovie is exicuted
the if statement is tested
the play head moves to the next frame

so no… that wouldn’t work. You need to have the if statement inside a loop of some sort so that it will be tested again and again, until it’s true.

preloading modules can be tricky, and most often needs to be tailor made for each project you’re working on. I, personaly, like to us a movie clip called “loader” with an onClipEvent(enterFrame){} method attached to it. Then I just set the loader to look at any particular clip that’s loading a movie. It gathers all of it’s data from that clip, and displays it in various dynamic text fields. Like I said though… it’s custom depending upon what you’re trying to accomplish.

can you give a real example of something you’re working on, rather than just a hypothetical situation?

example:

in the root timeline in frame one there is a loadMovie command, which loads a movie into a target clip, like so.

holderClip.loadMovie(“movieToLoad.swf”);

then on frame two we could place

trace(holderClip.getBytesLoaded()):

if that was all that was in our movie, we would see the output window pop up on test and list a bunch of numbers. (maybe… it might only list one if it loads quickly enough).

If it loads too quickly, you can simulate a longer load time by (while in test mode) using menu option “view/show streaming”.

Great response thankyou. You talk about your preferred method for loading:

[COLOR=orangered]I, personaly, like to us a movie clip called “loader” with an onClipEvent(enterFrame){} method attached to it. [/COLOR]

Could you provide an example for this, it seems to be exactly what I am looking for and very interesting to boot.

Er, sorry can’t provide example at this stage, still just trying to work out what works and doesn’t when it comes to preloading.

Maybe in a day or two.

Cheers for your help

I’ll see if I can find an example of my preloader clip and replicate it for you here. Need to look around for it.

*Originally posted by jimw00d *

_root.createEmptyMovieClip("container",1)
loadMovie("jellyfish.swf","container")
if(_root["jellyfish.swf"].getBytesLoaded**()**>=(_root["jellyfish.swf"].getBytesTotsl){
_root.play();
}

Be careful, you don’t access your movie with _root[“jellyfish.swf”] but with _root.container.

_root.createEmptyMovieClip("container",1)
container.loadMovie("jellyfish.swf");
// preloader
this.onEnterFrame = function(){
  var l=container.getBytesLoaded();
  var t=container.getBytesTotal();
  if (l && l >= t){
    container.play(); 
    // or _root.play(), I'm not sure about what you want to do
    delete this.onEnterFrame;
  }
  else container.stop();
}

pom :block:

thanks POM!!! :slight_smile:

Pom,

Also, what are the chances of cracking open that brain of yours and finding out a little more about your sliding menu tutorial. I have read, re-read etc the tutorial and still I can’t get my 3 menus of 700x100 to work in the same way as you have done.

Ok so the code in question is:

on (press) {
_root.xnew = _root.mask2._x+(4-1)*100/2;
}

I’ve done a .fla

Can you help or point me in the right direction

This is all relevant as I wish to dynamically load external swfs into each menu