Forum Moderators: open
Here is my code if anyone can help, I would really appreciate it.
var myRequest:URLRequest = new URLRequest("animation.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 = 499.5;
myPreloader.y = 327;
}
function showProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";
myPreloader.bar_mc.height = 200 * percentLoaded;
}
function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
}
Simplest would be to put a stop() in frame one of the animation, then on complete of the data loaded do myAnimation.play() from the parent movie. You might have to bump everything in the ani over one frame, putting nothing but stop() in the first frame, then do myAnimation.goToAndPlay(2).
My preloader is preloader.swf and the main animation is stored in the first line:
var myRequest:URLRequest = new URLRequest("animation.swf");
When I load it in Flash, by hitting CTRL+Enter twice, it loads fine, however in the browser, my problem happens.
I'll give your suggestions a whirl and let you know how I make out.