# Loading first scene while others load in the background

**URL:** <https://forum.kirupa.com/t/loading-first-scene-while-others-load-in-the-background/28448>\
**Category:** Uncategorized\
**Created:** [August 13, 2003, 9:16pm UTC](https://forum.kirupa.com/t/loading-first-scene-while-others-load-in-the-background/28448 "2003-08-13T21:16:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![future\_pilot](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@future\_pilot](https://forum.kirupa.com/u/future_pilot)\
**Post date:** [August 13, 2003, 9:16pm UTC](https://forum.kirupa.com/t/loading-first-scene-while-others-load-in-the-background/28448/1 "2003-08-13T21:16:02Z")

</div>

Hi all, had a quick question -  
The website I’m working on is a Flash swf hovering at about 2 megs, and although on a broadband connection, it still takes a few long seconds -  
Is there any actionscript that can tell my preloader to display my homepage immediatley after the homepage is loaded, while the rest of my site loads in the background?  
Below is my preloader code; if anyone can help me that would be eeexxcellent 🙂

stop();  
//preloader  
st = new Date();  
startSec = st.getSeconds();  
startMin = st.getMinutes();  
startHour = st.getHours();  
startDay = st.getDay();  
this.onEnterFrame = function() {  
tb = this.getBytesTotal();  
lb = this.getBytesLoaded();  
percent = Math.round(lb/tb_100);  
txtpercent = percent+" %";  
this.Loading\_bar.Bar.\_xscale = percent;  
tkb = Math.round(tb/1024);  
txttkb = tkb+" kb total";  
lkb = Math.round(lb/1024);  
txtlkb = lkb+" kb loaded";  
nkb = tkb-lkb;  
txtnkb = nkb+" kb remaining";  
nt = new Date();  
sec = nt.getSeconds()-startSec;  
min = nt.getMinutes()-startMin;  
hour = nt.getHours()-startHour;  
day = nt.getDay()-startDay;  
lsec = (day_24_60_60)+(hour_60_60)+(min\*60)+sec;  
txtlsec = lsec+" sec elapsed";  
speed = Math.round((lkb/lsec)\*10)/10;  
txtspeed = speed+" kb/s";  
nsec = Math.round(nkb/speed);  
txtnsec = nsec+" sec remaining";  
if (lb\>=tb) {  
delete this.onEnterFrame;  
txtspeed = “0 kb/s”;  
nextFrame();  
}  
};  
stop();

---

<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, 2003, 8:31am UTC](https://forum.kirupa.com/t/loading-first-scene-while-others-load-in-the-background/28448/2 "2003-08-14T08:31:07Z")

</div>

Hoi

ok well  
flash loads from start to end loading the mc,btn’s when flash meets then on the maintime line  
so if you laat it load to 50%(or less) then the home page ,if its in the first frame, will beloaded

```auto

stop();
//preloader
st = new Date();
startSec = st.getSeconds();
startMin = st.getMinutes();
startHour = st.getHours();
startDay = st.getDay();
this.onEnterFrame = function() {
tb = this.getBytesTotal()/2;// now it will ownly preload half the movie
lb = this.getBytesLoaded();
percent = Math.round(lb/tb*100);
txtpercent = percent+" %";
this.Loading_bar.Bar._xscale = percent;
tkb = Math.round(tb/1024);
txttkb = tkb+" kb total";
lkb = Math.round(lb/1024);
txtlkb = lkb+" kb loaded";
nkb = tkb-lkb;
txtnkb = nkb+" kb remaining";
nt = new Date();
sec = nt.getSeconds()-startSec;
min = nt.getMinutes()-startMin;
hour = nt.getHours()-startHour;
day = nt.getDay()-startDay;
lsec = (day*24*60*60)+(hour*60*60)+(min*60)+sec;
txtlsec = lsec+" sec elapsed";
speed = Math.round((lkb/lsec)*10)/10;
txtspeed = speed+" kb/s";
nsec = Math.round(nkb/speed);
txtnsec = nsec+" sec remaining";
if (lb>=tb {
delete this.onEnterFrame;
txtspeed = "0 kb/s";
nextFrame();
}
};
stop();

```

and please use

````auto
, 
```php
 or 

````

tags when posting code it makes it easyer the read 😉

---

<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, 2003, 4:56pm UTC](https://forum.kirupa.com/t/loading-first-scene-while-others-load-in-the-background/28448/3 "2003-08-14T16:56:00Z")

</div>

Hey Master 64, THANK YOU THANK YOU- you saved my arse!

-future\_pilot
