# Preloading in MX2004 -read this

**URL:** <https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692>\
**Category:** flash\
**Created:** [November 5, 2003, 8:48am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692 "2003-11-05T08:48:54Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyezberg](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@eyezberg](https://forum.kirupa.com/u/eyezberg)\
**Post date:** [November 5, 2003, 8:48am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/1 "2003-11-05T08:48:54Z")

</div>

MX 2004 uses a new component architecture,  
with a lot of classes being included right from the 1st usage on,  
which adds about 30k to the 1st frame even if you uncheck “export in 1st frame” on all of them.

There’s been a few questions on how to best preload mx2004 swf’s, so here’s what you need to read to solve all your troubles:

[http://www.jessewarden.com/archives/000295.html](http://www.jessewarden.com/archives/000295.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:** [November 10, 2003, 5:45pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/2 "2003-11-10T17:45:51Z")

</div>

it’s published in the docs…:cyclops:

ciao  
francesca

😉 anyway, thanks for the tip.

---

<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:** [November 10, 2003, 11:35pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/3 "2003-11-10T23:35:20Z")

</div>

ma dove?  
ciao anche a te  
and you’re double welcome  
(to the board and di niente)  
🙂

---

<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 4, 2004, 9:36am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/4 "2004-02-04T09:36:14Z")

</div>

Hey cmplx … I had the same thing happen. You can’t export to a frame further down, coz if you’re using the preloader component, you need to export it at frame one!!!

Even setting it manually thru the linkage doesn’t help. So, unless you’re making your own preloader (ie not using the component progress bar) this information is good.

However, if you WANT to use the progress bar … good luck in getting it to work the way it should! 🙂

Let me know if you manage to work around this error.

---

<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 4, 2004, 7:00pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/5 "2004-02-04T19:00:49Z")

</div>

tylernz,  
i had my own preloader set up, not the component. so i don’t know what is up still though. thanks for the response though.  
cmplx

---

<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 11, 2004, 1:47pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/6 "2004-02-11T13:47:12Z")

</div>

I like to work as much as possible with code inside .as files instead of building the GUI on the stage (reusability reasons, etc.).

Can anyone make this?

1. A .fla file with preloader (ProgressBar) and then (at a later frame) instantiate a class that makes a plain window in it’s constructor)
2. An .as file containing that simple class.

I did this:  
.fla with 3 frames  
1st frame - ProgressBar with “Export in first frame” checked  
2nd frame - set this as "Export frame for classes"  
3rd frame - instantiate the class

I should add, that window was dragged to the stage and deleted and “Export in first frame” option was unchecked.

I’ve made some variations (even let the window on stage at the 2nd frame) but the results were pretty much as follows:  
When simulating bandwidth it was working almost in every case  
When played directly the MX 2004 components were not showing correctly.

Does anybody has actual good, clean code on this?

I have also some test samples (the load is on the 1st frame, you should try to move it to 2nd and 3rd frame)

[Download](http://eurodevelop.iasi.astral.ro/downloads/preloader.zip) (.zip containing a .fla file and an .as file)

---

<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 11, 2004, 9:21pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/7 "2004-02-11T21:21:24Z")

</div>

sorry dalvi … this is over my head!

I did find another issue with components when loading them into another swf. You have to make sure this is an instance of your component you’re using on the main fla.

Understand? Say, you’ve got a seperate swf file that has a textarea component, and you’re loading that swf into your main swf. Well, then you’ll need to have an instance of the textarea component on the main swf as well for it to work properlly!

But, I’ve never delt with seperate .as files, and classes etc … so sorry I can’t help. Maybe make a new post in the actionscript section?

Good luck!

---

<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:** [August 7, 2004, 2:42am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/8 "2004-08-07T02:42:44Z")

</div>

I’ve found a similar problem working with attachMovie. Making a lot of objects in your library available to be used with attachMovie (i.e. choosing ‘export for actionscript’) causes a high first frame load which stops your preloader from appearing right away.

I’ve always got round this by making the preloader a seperate movie which loads the main movie into level 1. You can make the preloader movie as lightweight as you like so it appears quickly. All references to ‘\_root’ in you main movie will automatically point to \_level1 so your code should work without glitches.

---

<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:** [August 10, 2004, 11:48pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/9 "2004-08-10T23:48:05Z")

</div>

I’m looking for a peice of actionscript which will give me a load-bar preloader for an externally loaded .swf file. I’m not great with actionscript (though not totally out of it.) and am currently using the :

if (\_framesloaded\>=\_totalframes) {  
gotoAndPlay(3);  
} else {  
gotoAndPlay(1);  
}

approach, which doesn’t give me a loadbar. When I tried to use the loadbar like this:

bytes\_loaded = Math.round(\_root.getBytesLoaded());  
bytes\_total = Math.round(\_root.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
\_root.loadBar.\_width = getPercent_100;  
\_root.loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
\_root.gotoAndStop(3);  
}

(and with a “gotoAndPlay(1);” in the next frame)

it failed to work for both the regular movies within MX 2004 as well as the externally loaded ones. I know there’s an easy fix here…I just don’t know what it is.

---

<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:** [August 14, 2004, 6:18am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/10 "2004-08-14T06:18:19Z")

</div>

> [@cmplx](#):
>
> i followed francesca’s options to get around the extra load time with components and classes. however, when i tried to load the classes on frame 3 instead of frame 1, my components didn’t work. when i loaded the classes on frame 1, my preloader didn’t show up until 59%. basically i’m at a lose-lose situation right now. is there another work around to get this piece to work?  
> thanks.  
> cmplx.
> 
> download the fla here  
> [http://www.whatthedale.com/download/quote.fla.zip](http://www.whatthedale.com/download/quote.fla.zip)

I have that same problem, and it is a real pain in the butt! It has something to do with whats in your movie because i found if i just made a test movie with only three frames (frame 1, preloader; frame2, assets; frame 3, start of actual movie) I could get the components to behave. Sadly this issue is over my head as well.

---

<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:** [September 15, 2004, 4:25pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/11 "2004-09-15T16:25:53Z")

</div>

if (\_framesloaded\>=\_totalframes) {  
gotoAndPlay (2);  
} else {  
gotoAndPlay (1);  
}

would love some help on inserting a preloader on my movie clip wich shows on my home page dim:(304/176) & ( 1.3 mb )

should be simple: (flash mx 2004)  
imported mpg into stage took up to ( 285 ) then placed on homepage and works, but browsers still wait 4 movie to load, so would like to insert a basic preloader with bar & percetage. so browsers can see how long to wait 4 movie to load.

had tried all the scripts just does not seem to even play now that i’ve inserted even the simple one above.just stayes blank…

are you suppose to say how many frames to load or just leave script alone…  
you guys explane it well step by step wich i’ve done over and over but still no luck…

please help need asap [www.rhinodivot.com](http://www.rhinodivot.com)  
email [springermarc@hotmail.com](mailto:springermarc@hotmail.com)

---

<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:** [September 22, 2004, 4:43pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/12 "2004-09-22T16:43:12Z")

</div>

> [@cmplx](#):
>
> tylernz,  
> i had my own preloader set up, not the component. so i don’t know what is up still though. thanks for the response though.  
> cmplx

Hi cmplx, not sure if you figured this one out but it’s dead simple! (Discovered after spending half a day on it!!) :{

Simply change the ‘export frame for classes’ to i.e. 2, then open your library, right-click the component and choose ‘linkage’, then untick the ‘Export in first frame’ option.

You’ll notice that the .swf filesize increases (which is a good sign!), and that the component(s) now work.

---

<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:** [September 24, 2004, 7:00am UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/13 "2004-09-24T07:00:20Z")

</div>

I’ve tryed to go to the link below, but the page was empty:h:

[http://www.jessewarden.com/archives/000295.html](http://www.jessewarden.com/archives/000295.html)

so I tried to find the page from [http://www.jessewarden.com/](http://www.jessewarden.com/)  
but i couldn’t.

can anyone tell me the correct URL, please!

---

<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:** [September 28, 2004, 11:39pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/14 "2004-09-28T23:39:02Z")

</div>

messed up for me too

---

<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:** [September 29, 2004, 5:01pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/15 "2004-09-29T17:01:57Z")

</div>

Hello everyone,

I have a question that is driving me crazy.

Well, I just finished a Flash intro for [baltimorejazz.com](http://baltimorejazz.com). It has a preloader attached to it, which displays fine in IE, NN5+, & Opera, but breaks in NN4x(I know, crappy browser), and Firefox.

In the 2 previously mentioned browsers instead of displaying “x% complete,” (where x is percentage complete) it displays “NaN% complete.”

Any ideas?

Any help is appreciated.

Cheers,

John:D

---

<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:** [September 29, 2004, 5:24pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/16 "2004-09-29T17:24:04Z")

</div>

Could you show us your code? Which version of Flash are you using? Actionscript v1 or v2?

> [@jguchema](#):
>
> Hello everyone,
> 
> I have a question that is driving me crazy.
> 
> Well, I just finished a Flash intro for [baltimorejazz.com](http://baltimorejazz.com). It has a preloader attached to it, which displays fine in IE, NN5+, & Opera, but breaks in NN4x(I know, crappy browser), and Firefox.
> 
> In the 2 previously mentioned browsers instead of displaying “x% complete,” (where x is percentage complete) it displays “NaN% complete.”
> 
> Any ideas?
> 
> Any help is appreciated.
> 
> Cheers,
> 
> John:D

---

<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:** [October 1, 2004, 8:27pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/17 "2004-10-01T20:27:32Z")

</div>

> [@francescaluce](#):
>
> in the help panel…under \>ActionScript Reference Guide, you’ll find \>Creating Classes with ActionScript2.0…then \>How class are compiled and exported…::

Holy Crap Francesca,

that information just saved me hours of headaches. This is what makes the internet great. After 3 versions of flash documentation blowing pickles with huge inaccuracies and holes (since flash 4 in my opinion), I have just totally given up reading anything they write about their program.

This is, I believe, the FIRST TIME in about 3 years that I have read something in the help panel that not only was well written and not full of inaccuracies, but also ACTUALLY WORKED.

And I would never have known without your blessed post above.

:love:

Thank you!

will lanni  
red card studios :: general partner ::  
online: [http://www.redcardstudios.com](http://www.redcardstudios.com)

---

<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:** [October 1, 2004, 8:29pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/18 "2004-10-01T20:29:34Z")

</div>

> [@jguchema](#):
>
> Well, I just finished a Flash intro for [baltimorejazz.com](http://baltimorejazz.com). It has a preloader attached to it, which displays fine in IE, NN5+, & Opera, but breaks in NN4x(I know, crappy browser), and Firefox.
> 
> In the 2 previously mentioned browsers instead of displaying “x% complete,” (where x is percentage complete) it displays “NaN% complete.”

Not a Number. I wonder if Netscape 4 has the correct version of the flash player loaded into 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:** [October 1, 2004, 9:39pm UTC](https://forum.kirupa.com/t/preloading-in-mx2004-read-this/34692/19 "2004-10-01T21:39:57Z")

</div>

> [@m\_andrews808](#):
>
> I’ve always got round this by making the preloader a seperate movie which loads the main movie into level 1. You can make the preloader movie as lightweight as you like so it appears quickly. All references to ‘\_root’ in you main movie will automatically point to \_level1 so your code should work without glitches.

this has got to be the easiest way… I’ve never noticed an issue with classes or components not loading this way… has something changed for MX 2004?
