all groups > macromedia flash sitedesign > november 2007 >
You're in the

macromedia flash sitedesign

group:

Preloader loading trouble


Preloader loading trouble Fumo.dek
10/31/2007 7:47:17 PM
macromedia flash sitedesign: Hello all,
I have this loader that starts playing the content, before the content has
loaded entirely.
Now this is a problem because my content still sits there and does nothing
until it's all loaded anyhow.
Any thoughts.

Thanks
\\C

var requestObj:URLRequest = new URLRequest("kitoShell.swf");
var loaderObj:Loader = new Loader();
addChild(loaderObj);
loaderObj.load(requestObj);

loaderObj.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
preloadProgress);

function preloadProgress(event:ProgressEvent):void {
var loadedPercent:int = event.bytesLoaded / event.bytesTotal * 100;
preloader_mc.loadingBar_mc.loaderText_txt.text = loadedPercent + "%";
}

loaderObj.contentLoaderInfo.addEventListener(Event.COMPLETE, preloadComplete);
function preloadComplete(event:Event):void {
preloader_mc.visible = false;
}
Re: Preloader loading trouble Rob Dillon
11/2/2007 1:28:01 PM
You can hide the file that is downloading until its fully loaded and/or until
you want to actually use it.

1. Put a blank frame at the start of the .swf that you are loading. Tell the
clip to play when you want to use it.
2. Have the content in the loaded swf contained in a movieClip and set that
clip's visible property to false. Set it to true when you want to use the
loaded clip.
3. Give the loader object a position off the visible area of the stage. Move
the loader to the correct position on the stage once the file has loaded.
4. Set the loader object's alpha property to false, and change the value to
true when the file has loaded.

Mix and match and add animation as needed.
AddThis Social Bookmark Button