Loading a movie on FRAME 1?

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);
}

startPreload("load/answer.swf");

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:


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:


_root.doPreload();

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

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?

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?