PRELOADER!!!
for a more in depth preloader click here
We are going to make our loading movie on a new scene
We are going to start off with our preloader first, this frame is only going to have the text "Loading" and it will remain there until the website finishes loading. To do this, click once on the layer labeled Content then pick the Text Tool and write something in the middle of the stage. Make this a movie clip with an animation that will loop while your movie loads.
We are now going to write the code for the preloader, click once on the Actionslayer and then right-click it and select Actions to open up the Actions panel. Paste the code below to program the preloader.
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void {
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
if (total == loaded) {
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void {
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
if (total == loaded) {
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
This code is explained at AS3 Flash Preloader Tutorial. Please review that tutorial to learn about how this code works.
That completes our preloader part, close the Action panel once you are done to go back to your movie. We are going to start now working on the rest of the website. We will start off now by adding the background. You can use our background here to follow the tutorial. Simply right-click this image and selectCopy, we are going to paste it in Flash later.
No comments:
Post a Comment