# Loading a movie on FRAME 1?

**URL:** https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389
**Category:** Uncategorized
**Created:** [April 4, 2006, 8:08pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389 "2006-04-04T20:08:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [April 4, 2006, 8:08pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389/1 "2006-04-04T20:08:11Z")

</div>

Hi,

I used a Tutorial from Senocular to preload my movies internaly.  
My problem is simple:

The tutorial works only with onPress:

btn\_360.onPress = function() {  
startPreload(“load/answer.swf”);  
};

What I would like to do is to make a first movieclip load in the beginning without having to click any button or do anything. How can I starPreload automaticaly ? Here is the code on frame one:

* * *

btn\_360.onPress = function() {  
startPreload(“load/answer.swf”);  
};

// this function begins preloading a swf url  
function startPreload(url){

// assign the url to the preloader  
// it will load it internally  
preloader\_mc.url = url;

// set destination movie clip for loaded content  
preloader\_mc.target = content\_mc;

// begin the transition by playing frame 2  
preloader\_mc.gotoAndPlay(2);  
}

---

<div class="post-metadata">

### Author: ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)
#### Post date: [April 4, 2006, 8:10pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389/2 "2006-04-04T20:10:48Z")

</div>

```auto
startPreload("load/answer.swf");

```

---

<div class="post-metadata">

### Author: ![arriba](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@arriba](https://forum.kirupa.com/u/arriba)
#### Post date: [April 4, 2006, 8:15pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389/3 "2006-04-04T20:15:35Z")

</div>

easy…  
you do this, so the function is called when you press the button:

btn\_360.onPress = function() {  
startPreload(“load/answer.swf”);  
};

to call de funcion when was read by de player, do this:

```auto

function doPreload(){
    startPreload("load/answer.swf");
};
doPreload();

```

First you define de function, i called “dePreload”, then you call it, just writing its name. When de player reads the call apply the function. This is very usefull because, you could define functions in the \_root of de movie and call them from everywhere… for example, if you are inside another clip you could call the function again this way:

```auto

_root.doPreload();

```

That´s all… investigate it, you realize it´s very powerfull.

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [April 4, 2006, 8:27pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389/4 "2006-04-04T20:27:39Z")

</div>

Thank you very much.  
This is a very well explained and simplified version of the function. That trully helps cause I’m not a very advanced programmer. However, it still doesn’t work… well it almost loads… but freezes.

Actually, the code you provided does the same as my experiments:

FROM:

btn\_360.onPress = function() {  
startPreload(“load/apton.swf”);  
};

I TRIED:  
startPreload(“load/apton.swf”);  
};

and it did the same as using your code:  
function doPreload() {  
startPreload(“load/answer.swf”);  
};

doPreload();

The problem I see is that “startPreload” is already a function… so doing a doPreload() { startPreload , is a function within a function. So does that mean that I simply have to type:

startPreload(“answer.swf”);

on the first frame and it’s gonna load my clip?

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [April 4, 2006, 8:30pm UTC](https://forum.kirupa.com/t/loading-a-movie-on-frame-1/184389/5 "2006-04-04T20:30:42Z")

</div>

Defective:

I tried it before… I’m not a really advanced programmer, but logicaly it’s what I had came up with, and it doesn’t work. Is there an alternative?

> [@Defective](#):
>
> ```auto
> startPreload("load/answer.swf");
> 
> ```
