# Caching / Prelaoding external swf's for future loading

**URL:** https://forum.kirupa.com/t/caching-prelaoding-external-swfs-for-future-loading/183818
**Category:** flash
**Created:** [March 30, 2006, 10:50am UTC](https://forum.kirupa.com/t/caching-prelaoding-external-swfs-for-future-loading/183818 "2006-03-30T10:50:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JamesTaylor](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@JamesTaylor](https://forum.kirupa.com/u/JamesTaylor)
#### Post date: [March 30, 2006, 10:50am UTC](https://forum.kirupa.com/t/caching-prelaoding-external-swfs-for-future-loading/183818/1 "2006-03-30T10:50:16Z")

</div>

i’m working on my portfolio site and i have a no. of external movies which are loaded into the main site for different sections (sample animations etc.)

what i would like to be able to do is once my starting point / 1st frame has been loaded is to start caching / preloading the external movies as a background task, so when they are called any potential loading time is reduced.

can this be done? and can anyone point me in the right direction?

thanks

James

---

<div class="post-metadata">

### Author: ![JamesTaylor](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@JamesTaylor](https://forum.kirupa.com/u/JamesTaylor)
#### Post date: [March 30, 2006, 2:11pm UTC](https://forum.kirupa.com/t/caching-prelaoding-external-swfs-for-future-loading/183818/2 "2006-03-30T14:11:27Z")

</div>

the following action script is placed on a MC acting as a button, what i would like to do is have the MC that is created go down a list of external swf’s and load then one by one in the background, when the 1st one is loaded it just moves onto the next one, then the next one etc etc. as a means of caching the files that will be called into use later on

```auto
this.onRollOver = function(){
createEmptyMovieClip("parent", 1);
parent.createEmptyMovieClip("child", 1);
parent.child.loadMovie("MoseleyStreetImage.swf");
parent.child.onLoadComplete.loadMovie("ParkLaneImage.swf");
//parent._visible = false;

//if(parent.child._framesloaded =1){
	//parent.child.loadMovie("ParklaneImage.swf");
//}
}

```

can it be done, help needed please!!

in the meantime, i’m going to try having a MC that moves along the timeline each time an external swf is loaded, that way i guess i can place action script on each frame telling it load the next swf???

---

<div class="post-metadata">

### Author: ![serkios](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/serkios/32/608_2.png) [@serkios](https://forum.kirupa.com/u/serkios)
#### Post date: [March 30, 2006, 8:03pm UTC](https://forum.kirupa.com/t/caching-prelaoding-external-swfs-for-future-loading/183818/3 "2006-03-30T20:03:49Z")

</div>

It can be done. When I’ve been asked to do something like this I setup the \_root of my timeline to contain all the content within MCs on each frame. Each frame has a label and acts as a program state. Basically you can setup code such that if the content on frame 2 is loaded (say your landing page), but the rest isn’t loaded yet the player can still move ahead to that frame while the rest continues to load. So the code can look something like:

on frame 1:  
[FONT=Courier New][/FONT]

```auto
stop();
loader.onEnterFrame = function () {
if (_root._framesloaded >= 2) {
_root.gotoAndStop("landing");
}
}

```

Something along those lines
