[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 866
  • Last Modified:

bytesTotal for Flash preloader AS3

Hello,

I am trying to build a Flash preloader. From this Flash file, I am dynamicly loading another Flash file. This is an SWF file of 30MB. I made it this big to test the progressbar.

While loading this SWF file, I want to show the progress of the loading in percentage. I have attached the used code.
I am showing the event.bytesTotal to the screen. But the strange thing is, that this bytesTotal is changing all the time, and it is always the same as bytesLoaded. How can I return the total file size so I can calculate the progress of the loading ?
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, Dcomplete);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
loader.load(new URLRequest("movie.swf"));

function showProgress(event:ProgressEvent):void {
	var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
	percentLoaded = Math.round(percentLoaded * 100);
	textf.text = String(event.bytesTotal);
}

Open in new window

0
eelcol
Asked:
eelcol
  • 2
1 Solution
 
eelcolAuthor Commented:
It does seem to work if I debug it locally. But when using the swf file online, it doesn't return the right bytesTotal value.
0
 
NiklasMollerCommented:
hello!

I googled around for this and there seems to be a problem with this happening to more people than you :)

It might be a problem/quirk with how your server provides the flv file to the client. Seemingly it does not provide correct values.

I am not providing a solution here, but pointing you to some more links where people have had the same problem:

http://stackoverflow.com/questions/1269875/why-loaderinfo-bytestotal-is-zero
http://www.bigresource.com/Tracker/Track-flash-InVLAke3S7/
http://www.bigresource.com/Tracker/Track-flash-mtyV9Gkm5/

hope you can solve it!
cheers
0
 
eelcolAuthor Commented:
Hi

Thanks, I also found an article like that:

http://patrickmcd.com/2009/04/20/flash-preloading-errors-turn-off-gzip/

I have forwarded it to my hosting provider, I hope they can help me with this. Thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now