Donnerstag, 10. Januar 2008

Custom preloader final version

Code updated!




I finally find 10 minutes to try to put a progress information in the progress bar control.
The solution was to use a TextField objet write some stuff in it, use a BitmapObject to copy the TextField object into it and then draw the new created BitmapData object on the big one.
Here is the code to only draw the progress text:

var textField: TextField = new TextField();
textField.htmlText = m_Progress.toFixed(0) + "%";
var textBitmapData: BitmapData = new BitmapData(textField.textWidth + 5, textField.textHeight);
textBitmapData.floodFill(0, 0, ProgressBarBackground);
textBitmapData.draw(textField);
var textBitmapMatrix: Matrix = new Matrix();
textBitmapMatrix.translate(px + (containerWidth) / 2, py + (ProgressHeight - textBitmapData.height) / 2);



The full source code can be found here . (Right click somwhere and select "View code..." to see the source code)

As usual, if someone improve the code please post a comment.

UPDATE:

Thanks for the info there is something wrong with the "view source..." function.
I added an archive file with the source code. this can be found here
Sorry for this.