Swf loading question

How do you make it so that the viewer can’t see the movie until it has completely uploaded?If the view is on a slow connection and clicks on the button the swf would stop before completely downloading. Help would be appreaciated. thanks

The easiset way is to construct a preloader. At its simplest this is a loop over two frames governed by an if () statement.

if you place this AS on the third frame of your movie

if (this.getBytesLoaded < this.getBytesTotal()) {
gotoAndPlay (_currentFrame-1);
}

then the movie will hop between frames 3 and 2 until the movie has fully loaded - i.e. until the total number of bytes to be loaded is the same as the total number of bytes that have been loaded

If you’re running your movie at the default rate of 12 fps then this if statement will be processed 6 time a second - which is unnecessarily often. If you placed the AS on the 12th frame and changed it to

if (this.getBytesLoaded < this.getBytesTotal()) {
gotoAndPlay (_currentFrame-11);
}

then it would only perform the if () statement once every second which is probably often enough for a preloader

As long as the first 12 frames are empty then the viewer won’t see any thing - or you could include a simple animation etc to keep them entertained.