[mx] help! preloader

Hi there
I want to create a preloader (in flash)(with the “percent-loaded”-thingie) for an external .html file that I want to load. Here’s my code:

[color=red]lBytes = _root.getBytesLoaded();
tBytes = _root.getBytesTotal();
percentLoaded = Math.floor((lBytes/tBytes)*100);
loader.bar._xscale = percentLoaded;
loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + “K loaded.”;
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
gotoAndStop(“main”);
} else {
count++;
gotoAndPlay(“preload”);
}
} else {
gotoAndPlay(“preload”);
}[/color]

On the “main” frame" I’ve put a getURL action on a movieclip.
Can this work.??? I’m still new at this and a bit confused? Pls help!!!

try this link…
the easiest way to make a preloader…
http://www.kirupa.com/developer/mx/percentagepreloader.htm

Ok, the loader works, but must I put a getURL-action in frame 3? Or how do I “attach” the seperate file? That only explains how to load a movieclip?!!
Pls help me! And thanks for the previous advise.

well…
if u put a getURL on the third frame in my opinion (at least that’s what happened to me)… it will open the URL non stop…
so what u can do is to create another flash page that redirects u to the site it self…
like:
“Press Here To Enter The Site”…
i hope i helped…
i have a question to u…
r u trynig to preload an html page?

Yes… is that wrong? Can you do it? I’ve put a .swf file inside a html file…

well thats not hard…
if i were u i would of placed the preloader in one scene and the the main page that u preload in the next scene…
and in the third frame of ur preloader write:


this.gotoAndPlay(nextScene());
or
this.gotoAndPlay("frame_label");
 
 
and in the first frame of the main scene write:
play();
otherwise it will just stop when it goes to the next scene....

or u can just put another page in the third frame as i said
and in that page put a button and some graphics…
and put a button that says:
"Press Here To Enter The Site"
and give the button the action:


on(release){
    this.gotoAndPlay(nextScene());
}
and again in the first frame of the main scene write:
play();

and don’t worry in should preload all the scenes not only the third frame…
i hope i’ve been helpful…

Thank u soooooo much. I’m gonna try it and come back 2 u!!!