The first workaround for the bit component set?

Posted on Thursday 30 December 2004

I received the bit component set after a client asked me to shave some kbs off of some of the movies I had made for him. I replaced the loader component, which sends progress and load events, and linked it to a progress bar. I compared it to the original and there seemed to be a lag though between the bar disappearing and the pic showing up.

Indeed, the progress event handler was called 8 times after the pic was loaded (when the progress value is at 100). 8 times? That seems like a lot. I guess the point of the lag is to allow the width and height properties to be set properly (a bug of the Flash Player). 8 frames might be all right for a movie set at 60fps, but mine was running at 15fps, hence a lag of half a second. I narrowed down the culprit to an internal variable of the loader component, __loaded, that is used to count the frames between end of loading and firing the load event.

All that needed to be done is increment this value manually in the progress event handler, like so:

function handleLoadProgress(eventObj)
{

        eventObj.target.progressBar.value = eventObj.target.progress;
        if(eventObj.target.progress == 100)
        {
                eventObj.target.__loaded += 3;
        }
}

This way instead of waiting 8 frames, it only waits 2 frames. By adjusting the increment value, you can make this faster or slower. 3 was the magic value for me, the highest value that gave correct width and height values from the loader, but your mileage may vary.


WordPress database error: [Can't open file: 'wp_comments.MYD'. (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '17' AND comment_approved = '1' ORDER BY comment_date

No comments have been added to this post yet.

Leave a comment




Your e-mail address is never displayed. If you run into issues with SpamKarma blocking you, email me at $patrick->5etdemi(com)


RSS feed for comments on this post | TrackBack URI