bytesTotal for Flash preloader AS3

Posted on 2010-01-03
Last Modified: 2013-11-11

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

Question by:eelcol

    Author Comment

    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.
    LVL 5

    Accepted Solution


    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:

    hope you can solve it!

    Author Comment


    Thanks, I also found an article like that:

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

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
    There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now