I’m using the preloader example from:
http://www.monkeyflash.com/flash/creating_a_custom_preloader/
However, it’s currently playing the .swf that it’s supposed to be preloading as if there was no preloader at all. As soon as the .swf loads to about 14%, it starts playing. I need it to autostart once it’s loaded, but I don’t know how to keep it from starting to play as soon as it’s loaded enough.
I made a seperate flash file with the following code in the first frame.
var myRequest:URLRequest = new URLRequest(“schilsky_embedded_semifinal_evenEnd2.swf”);
var myLoader:Loader = new Loader();
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);
var myPreloader:Preloader = new Preloader();
function showPreloader(event:Event):void {
addChild(myPreloader);
myPreloader.x = stage.stageWidth/2;
myPreloader.y = stage.stageHeight/2;
}
function showProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = “Loading " + Math.round(percentLoaded * 100) + " %”;
myPreloader.bar_mc.width = 198 * percentLoaded;
}
function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
var myRequest:URLRequest = new URLRequest(“schilsky_embedded_semifinal_evenEnd2.swf”);
var myLoader:Loader = new Loader();
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);
var myPreloader:Preloader = new Preloader();
function showPreloader(event:Event):void {
addChild(myPreloader);
myPreloader.x = stage.stageWidth/2;
myPreloader.y = stage.stageHeight/2;
}
function showProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = “Loading " + Math.round(percentLoaded * 100) + " %”;
myPreloader.bar_mc.width = 198 * percentLoaded;
}
function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
}
I’d also love to know why a cursor doesn’t show up in the message box for me. I’m using Firefx 3.0.5.