docaberle
asked on
Progress Event only shows when close to finishing the load
I'm loading a swf that's about 3MB in size so it takes about 4 seconds to load. Simple stuff yet the text field only updates just prior to the file being loaded and not during the majority of the loading. I've included the file code here. Any suggestions why it's not working correctly. The other odd thing is that if I have the trace statement it spits out all the values but it displays them all at once only after the load is done. It's like there's something hanging up flash that doesn't allow it to trace the numbers either...This might explain why the text field only shows up 100% right when it's done.
Security.allowDomain("*");
var myMovie:Sprite;
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop, false, 0, true);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done, false, 0, true);
l.load(new URLRequest("http://www.grxsolutions.com/gtslideshow3/slides/sampleslide2.swf?c="+Math.random()));
function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
//trace(e.bytesLoaded+" "+e.bytesTotal);
}
function done(e:Event):void
{
percent = null;
myMovie = Sprite(l.content);
addChildAt(myMovie,0);
l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
l = null;
}
You can simulate slow bandwidth in the flash player
Run the movie from the flash IDE
click View->Download Setting and select the bandwidth you want to test on
then
click View->Simulate Download
Run the movie from the flash IDE
click View->Download Setting and select the bandwidth you want to test on
then
click View->Simulate Download
if you find your preloader starts showing up later it's could also be that you have too many items that have export for frame 1 selected - you can't just turn that all off, it depends how you've coded, but if your file is too frame 1 heavy, your preloader needs to load all that first.
ASKER
blue-genie: Are you referring to frame 1 of the swf that I'm loading or the main swf? because yes all the assets in the loaded swf's are in frame 1 because I was trying to bulk them up due to my fast internet connection. Or do I need to test these preloaders on a 56k modem?
ASKER
hobbit72: As for testing in the IDE, my main swf is downloading from the internet so isn't that different? ie the loaded swf's are all on the server except for my main swf which is run from the IDE.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER