# Another goofy MX quesiton regardng preloading for external JPEG's

**URL:** <https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797>\
**Category:** flash\
**Created:** [February 18, 2003, 7:42am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797 "2003-02-18T07:42:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![aamiic](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@aamiic](https://forum.kirupa.com/u/aamiic)\
**Post date:** [February 18, 2003, 7:42am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/1 "2003-02-18T07:42:05Z")

</div>

I want to preload, and possibly use a transition to bring the image into focus once loaded… I assume I use the same idea as a preloader for a movie, but need a little guidence?

---

<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:** [February 18, 2003, 8:41am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/2 "2003-02-18T08:41:54Z")

</div>

Ok, got the image to load dynamically on a button press, now I’d like to know how I’d go about having a ‘loading bar’ icon for larger images that I’ll be displaying…

---

<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:** [February 19, 2003, 8:13am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/3 "2003-02-19T08:13:06Z")

</div>

No one?

---

<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:** [February 19, 2003, 8:14am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/4 "2003-02-19T08:14:20Z")

</div>

Nope, I don’t know. I tried it once before and all mine would do is say 0% then stay there then say 100% and show the picture, so it was pretty useless.

Sorry man.

---

<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:** [February 19, 2003, 8:37am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/5 "2003-02-19T08:37:56Z")

</div>

I don’t understand your question :beam:

1. Did you solve that “Come into focus” thing?
2. What do you mean a ‘Loading Bar’ icon? Are you talking about a preloader for you jpegs?

---

<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:** [February 19, 2003, 8:39am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/6 "2003-02-19T08:39:52Z")

</div>

I believe they mean a preloader for your dynamically loaded .jpg images. Where it shows a preloader bar in place of the empty area that normally shows and then shows the image when it is done loading.

Note: I would be INCREDIBLY grateful if you could answer this one Ilyas. As I said about my last one, it failed miserably and I couldn’t figure it out, it drove me nuts! And I am really looking for one for something I want to do.

---

<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:** [February 19, 2003, 8:59am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/7 "2003-02-19T08:59:43Z")

</div>

Well, it’s no different from an swf preloader :trout:

If you have a container clip in your timeline, something like this should work:

```auto
this.createEmptyMovieClip("preloader",1000);
container.loadMovie("myJPG.jpg");
container._visible=false;
preloader.onEnterFrame=function(){
  var l=container.getBytesLoaded();
  var t=container.getBytesTotal();
  if (l > 0 && l >= t){
    container._visible=1;
    delete this.onEnterFrame;
  }
  else {
    // stuff with your loading bar
  }
}

```

Am I answering your question? [SIZE=1]sorry if I’m not, it’s still early here :P[/SIZE]

---

<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:** [February 19, 2003, 9:01am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/8 "2003-02-19T09:01:55Z")

</div>

It is early here too… 4am. This sounds right though, thanks. For some reason I tried something just like this but it didn’t work. I want to try it again now.

---

<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:** [February 19, 2003, 9:05am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/9 "2003-02-19T09:05:16Z")

</div>

Get some sleep first 😛

---

<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:** [February 19, 2003, 9:10am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/10 "2003-02-19T09:10:28Z")

</div>

Me? Sleep? Whats that?!?!?!

Anywho, it isn’t working. It says that container is undefined in the trace window. Now that I have a base (that looks almost exactly like what I had before 🙂 I will keep at it.

And yes… i know container is a clip I have to make… before you say something smart…lol.

---

<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:** [February 19, 2003, 9:13am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/11 "2003-02-19T09:13:24Z")

</div>

HEHEHE… got it. ■■■■ typos… switch some letters and it doesn’t want to work. What is up with that!?!.. :trout: \<-- to me.

---

<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:** [February 19, 2003, 11:22am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/12 "2003-02-19T11:22:15Z")

</div>

Thanks guys, and yes that’s exactly what I was looking for, sorry I didn’t explain it more.

I’ll try this tommorow!

🙂

---

<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:** [February 19, 2003, 2:15pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/13 "2003-02-19T14:15:27Z")

</div>

Come on people, let’s all :trout: Lost!

:evil:

---

<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:** [February 19, 2003, 2:21pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/14 "2003-02-19T14:21:32Z")

</div>

Allright a ceremonius trout slapping for beta!

:trout::trout: 🙂

---

<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:** [February 19, 2003, 2:31pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/15 "2003-02-19T14:31:25Z")

</div>

may i paticipate? :trout: :trout: :trout:

But, ■■■■ lost…you are one creative mofo, ill be looking for your name in the future, keep up the good work :trout:

---

<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:** [February 19, 2003, 6:10pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/16 "2003-02-19T18:10:01Z")

</div>

hehehe, I almost forgot about my stupid mistake :trout:

And thanks fade-away 🙂

---

<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:** [February 19, 2003, 10:26pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/17 "2003-02-19T22:26:48Z")

</div>

Ok, maybe I’m a bit in over my head, could someone show me how you go about placing the loading bar?

A sample FLA would be greatly appreciated.

Mucho thx.

---

<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:** [February 19, 2003, 11:49pm UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/18 "2003-02-19T23:49:17Z")

</div>

```php
this.createEmptyMovieClip("preloader", 1000);
this.createEmptyMovieClip("container", 1001);
container.loadMovie("yourImage.jpg");
container._visible = false;
preloader.onEnterFrame = function() {
	var l = container.getBytesLoaded();
	var t = container.getBytesTotal();
	var getPercent = l/t;
	loadText = Math.round(getPercent*100)+"%";
	loadBar._width = getPercent*100;
	if (l>0 && l>=t) {
		container._visible = 1;
		delete this.onEnterFrame;
	}
};

```

That is the code I used.

loadText is a dyanmic textbox on the stage with the VAR name (not instance name) of “loadText” and it shows the percent loaded.

loadBar is a movie clip on the stage with the instance name “loadBar” and its width increases depending on the amount loaded (note: change the 100 in this line to the final width of your loadBar clip).

EDIT: Here is my code in action. [VIEW HERE](http://www.lostinbeta.com/images/dynamicPreloader.html)

---

<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:** [February 20, 2003, 9:54am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/19 "2003-02-20T09:54:38Z")

</div>

Thanks!!

I noticed it doesn’t cache the image? Seems to reload each time.

---

<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:** [February 20, 2003, 10:23am UTC](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797/20 "2003-02-20T10:23:54Z")

</div>

Ok, still a little lost, what am I doing wrong?

```auto

button.onPress = function () {
	this.createEmptyMovieClip("preloader", 1000);
	this.createEmptyMovieClip("container", 1001);
	container.loadMovie("test.jpg");
// container._x = 250 ;
//	container._y = 0 ;
	container._visible = false;
	preloader.onEnterFrame = function() {
	   	var l = container.getBytesLoaded();
	    var t = container.getBytesTotal();
	    var getPercent = l/t;
// loadText = Math.round(getPercent*100)+"%";
	    loadBar._width = getPercent*500;
	    if (l>0 && l>=t) {
  	        container._visible = 1;
    	    delete this.onEnterFrame;
   		}
	}
};

```

[Next page](https://forum.kirupa.com/t/another-goofy-mx-quesiton-regardng-preloading-for-external-jpegs/13797.md?page=2)
