Actionscript: 3.0
I'm probably doing something stupid (again); hence why I'm ask this here (newbie section).
Right now I have a separate Preloader (.fla) that has a UILoader component behind the movieclip that contains all the loading information (aka the percentage complete). This UILoader loads an external swf file, which is in the same folder as the preloader's swf.
I have NO errors coming out of this but when I preview I get just the movieclip and no activity.
If I comment out the section below "Test Section" and activate that (Test Section) the movieclip displays "42%"; no errors. So at least the movieclip stuff all works.
Apparently, the UILoader is failing to load the swf file but doesn't trigger any errors.
Quote:
UILoader Properties:
Instance Name: siteLoader
autoLoad: Checked
enabled: Checked
maintainAspectRatio: Checked
scaleContent: Unchecked [tends to screw up the movieclips]
source: Intentionally left blank as it should have been set in AS (siteLoader.load[...])
visible: Checked
|
Code:
stop();
/*Test Section
var percent:int = 42;
preloader_mc.percentText.text = percent + "%";
*/Test Section
import flash.net.URLRequest;
import flash.events.Event;
this.siteLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
this.siteLoader.addEventListener(Event.COMPLETE, completeHandler);
function progressHandler(e:ProgressEvent):void
{
var siteLoaded:Number = e.target.bytesLoaded;
var siteTotal:Number = e.target.bytesTotal;
var percent:int = siteLoaded/siteTotal;
preloader_mc.visible = true;
siteLoader.load(new URLRequest("test.swf"));
preloader_mc.percentText.text = percent + "%";
}
function completeHandler(e:Event):void
{
preloader_mc.visible = false;
this.siteLoader.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
this.siteLoader.removeEventListener(Event.COMPLETE, completeHandler);
}