ForumsProgramming ForumFlash Game Preloader

0 3817
macco
offline
macco
19 posts
Nomad

I put this code on the first frame of my game:



stop();

addEventListener(Event.ENTER_FRAME, loadProgress);

function loadProgress(event:Event) {
// get bytes loaded and bytes total
var movieBytesLoaded:int = this.root.loaderInfo.bytesLoaded;
var movieBytesTotal:int = this.root.loaderInfo.bytesTotal;

// convert to KiloBytes
var movieKLoaded:int = movieBytesLoaded/1024;
var movieKTotal:int = movieBytesTotal/1024;

// show progress
progressText.text = "Loading: "+movieKLoaded+"K/"+movieKTotal+"K";

// move on if done
if (movieBytesLoaded >= movieBytesTotal) {
removeEventListener(Event.ENTER_FRAME, loadProgress);
gotoAndStop(2);
}
}


But in the internet the preloader doesn't show up unti the game has already loaded.

So how can i make the preloader how up and tell me how much the game has loaded.


thanks for your help
macco

  • 0 Replies
Showing 1-0 of 0