PDA

View Full Version : preloader not showing up until 100% loaded...


newsteve
07-09-2009, 05:38 PM
preloader is not showing up until everything is loaded...

using AS3 in CS4. the strange thing is that the code is copied verbatim from a working preloader I used in CS3... also AS3... so I have no idea why its not working here... there can't be differences between CS3 and CS4 that are affecting it...???

I've tried various things, even hiding all of the content on the first frame with the preloader... but no luck! What could be the problem?

Help!

Code:

stop();

addEventListener(Event.ENTER_FRAME, myloading);
function myloading(event:Event) {
var bytestotal:Number = stage.loaderInfo.bytesTotal;
var bytesloaded:Number = stage.loaderInfo.bytesLoaded;

if (bytesloaded >= bytestotal) {
gotoAndPlay(2);
removeEventListener(Event.ENTER_FRAME, myloading);
}
}

TomMalufe
07-09-2009, 05:49 PM
Classic problem with preloaders is that you have ALL of your assets set to export on frame 1. This means Flash will not display frame 1 until everthing is loaded. Sadly, frame 1 is where your preloader is...

Fix this by exporting everything to frame 2.

newsteve
07-09-2009, 05:56 PM
OK I did this... the preloader now shows up and appears to work fine... however upon loading all of my assets are screwed up on stage... i believe this is because using scaleMode/stageScaleMode etc, I have aligned everything on the stage according to screen size etc... the code for this (even though on frame 3 with everything else) does not seem to be being read by the compiler...

anyone have any experience dealing with this type of problem?

thanks