Jump to content
Search Community

Hide Preloader after External SWF has loaded

forrestmaready test
Moderator Tag

Recommended Posts

I have a generic preloader swf with progress bar. After my external swf has loaded, I can still see my preloader swf. It's not completely on the top layer of the display list, but it's pretty easily visible.

 

Is there an easy way to completely hide the Preloader Swf once it's done loading the external swf?

 

Many thanks-

 

 var loader:SWFLoader;

 public function PreLoader() {
  loader = new SWFLoader("game.swf", {name:"mainSWF", container:this, x:50, y:100, onprogress:progressHandler, estimatedBytes:9500});
  loader.load();
 }

 function progressHandler(event:LoaderEvent):void {
  progBar.scaleX = event.target.progress;
 }

 function completeHandler(event:LoaderEvent):void {
  addChild(event.target.content);
 }

Link to comment
Share on other sites

yes, in your completeHandler just do

 

progBar.visible = false
//or for a nice fade out:
TweenLite.to(progBar, .5, {alpha:0});

 

I noticed that your onComplete isn't registered in your SWFLoader constructor. So you will need to further do this:

 

loader = new SWFLoader("game.swf", {name:"mainSWF", container:this, x:50, y:100, onprogress:progressHandler, onComplete:onCompleteHandler, estimatedBytes:9500});

 

also, since you are specifying a container in your SWFLoader you don't need to do

addChild(event.target.content);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...