Coupling a picture load with function call

Hi,

in my flash, I have an interface which loads pictures through button clicks. During the “loading stage” of every picture, a preloader animation is displayed.
Currently, after the swf starts, the first picture is loaded without said preloader animation. I wish to call the preloader function (see code example below) ONCE during startup of the swf, with the first picture load.
I’m sure this is an easy one for you guys :slight_smile:
Thanks in advance!

loadMovie(“load/beach.jpg”, _root.content_mc);

// image 1 loads the beach image using startPreload
image1_btn.onPress = function(){
startPreload(“load/beach.jpg”);
}

// image 2 loads the building image using startPreload
image2_btn.onPress = function(){
startPreload(“load/building.jpg”);
}

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

}