# Things that never work for me

**URL:** https://forum.kirupa.com/t/things-that-never-work-for-me/18291
**Category:** Uncategorized
**Created:** [April 15, 2003, 6:56am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291 "2003-04-15T06:56:47Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)
#### Post date: [April 15, 2003, 6:56am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/1 "2003-04-15T06:56:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 15, 2003, 7:23am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/2 "2003-04-15T07:23:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 15, 2003, 7:27am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/3 "2003-04-15T07:27:56Z")

</div>

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”.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 15, 2003, 9:16am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/4 "2003-04-15T09:16:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 15, 2003, 10:03am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/5 "2003-04-15T10:03:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 15, 2003, 10:34am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/6 "2003-04-15T10:34:41Z")

</div>

> \*Originally posted by jimw00d \*

```auto
_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.

```auto
_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:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 16, 2003, 5:32am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/7 "2003-04-16T05:32:10Z")

</div>

thanks POM!!! 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 16, 2003, 10:49am UTC](https://forum.kirupa.com/t/things-that-never-work-for-me/18291/8 "2003-04-16T10:49:35Z")

</div>

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
