# Dynamic Image Loader

**URL:** <https://forum.kirupa.com/t/dynamic-image-loader/204743>\
**Category:** flash\
**Created:** [October 23, 2006, 4:51am UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743 "2006-10-23T04:51:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![riveroaks](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@riveroaks](https://forum.kirupa.com/u/riveroaks)\
**Post date:** [October 23, 2006, 4:51am UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743/1 "2006-10-23T04:51:47Z")

</div>

I’m trying to create a dynamic image loader that I can use to show a loading bar for each of my images in my portfolio page. What I want to accomplish is basically here:

[http://www.kirupa.com/developer/actionscript/moviecliploader.htm](http://www.kirupa.com/developer/actionscript/moviecliploader.htm)

problem is I don’t have MX 2004, I’m working in MX. Does anyone know where I can find out how to create a dynamic image loader in MX with that loading class? My main problem is that I can’t seem to access my JPG to find out how much of it has loaded. I’m not new to preloaders but obviously if I can’t access AmountLoaded and AmountTotal then I can’t run a preloader. Any help is appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [October 24, 2006, 2:19am UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743/2 "2006-10-24T02:19:27Z")

</div>

The movieClipLoader was implemented until MX2004. Why not just use a basic preloader using getBytesLoaded and getBytesTotal?

```auto

function loadIt(image) {
    holder.loadMovie(image);
    onEnterFrame = function () {
        BL = holder.getBytesLoaded();
        BT = holder.getBytesTotal();
        percent = Math.round(BL/BT*100);
        if (BL == BT && holder._width>1) {
            delete onEnterFrame;
        }
    };
}
loadIt("image.jpg");

```

---

<div class="post-metadata">

**Author:** ![riveroaks](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@riveroaks](https://forum.kirupa.com/u/riveroaks)\
**Post date:** [October 24, 2006, 6:23pm UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743/3 "2006-10-24T18:23:10Z")

</div>

[QUOTE=rhamej;1984036]The movieClipLoader was implemented until MX2004. Why not just use a basic preloader using getBytesLoaded and getBytesTotal?

```auto

function loadIt(image) {
    holder.loadMovie(image);
    onEnterFrame = function () {
        BL = holder.getBytesLoaded();
        BT = holder.getBytesTotal();
        percent = Math.round(BL/BT*100);
        if (BL == BT && holder._width>1) {
            delete onEnterFrame;
        }
    };
}
loadIt("image.jpg");

```

[/QUOTE]

I tried that before but for some reason I couldn’t seem to access the image’s BytesLoaded and BytesTotal…I don’t know why, I thought it was some shortcoming with Flash’s treatment of JPG’s. Am I wrong here? If you tell me that you know for sure that I should be able to get those properties for a JPG in MX then I’ll go back to my code and disect it, but I tried applying the normal preloading techniques once before and they wouldn’t work…

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [October 24, 2006, 6:46pm UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743/4 "2006-10-24T18:46:14Z")

</div>

[QUOTE=riveroaks;1984517] If you tell me that you know for sure that I should be able to get those properties for a JPG in MX then I’ll go back to my code and disect it[/QUOTE]

I know for sure as does rhamej (or is it now rha ?)

if you get stuck copy/paste your code

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [October 24, 2006, 9:10pm UTC](https://forum.kirupa.com/t/dynamic-image-loader/204743/5 "2006-10-24T21:10:53Z")

</div>

[quote=stringy;1984527]I know for sure as does rhamej (or is it now rha ?)  
[/quote]:lol:
