# Preload external text file can't display percentage

**URL:** https://forum.kirupa.com/t/preload-external-text-file-cant-display-percentage/287783
**Category:** flash
**Created:** [May 6, 2009, 6:08am UTC](https://forum.kirupa.com/t/preload-external-text-file-cant-display-percentage/287783 "2009-05-06T06:08:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![iAMi](https://avatars.discourse-cdn.com/v4/letter/i/3bc359/32.png) [@iAMi](https://forum.kirupa.com/u/iAMi)
#### Post date: [May 6, 2009, 6:08am UTC](https://forum.kirupa.com/t/preload-external-text-file-cant-display-percentage/287783/1 "2009-05-06T06:08:59Z")

</div>

I want to load an external text file, and display loading percentage in flash,so I could show user how far loading is completed.  
And the problem is I can see progress in trace window,no progross message displays in the textfield,only when my text is completly loaded,the whole text shows in flash.

## code:

## var mytxt\_txt:TextField=new TextField(); mytxt\_txt.x=10; mytxt\_txt.y=10; mytxt\_txt.width=400; mytxt\_txt.height=300; mytxt\_txt.multiline = true; mytxt\_txt.wordWrap = true; mytxt\_txt.border = true; addChild(mytxt\_txt); // var \_txtloader:URLLoader = new URLLoader(); \_txtloader.addEventListener(Event.COMPLETE, completeHandler); \_txtloader.addEventListener(ProgressEvent.PROGRESS, progressHandler); \_txtloader.load(new URLRequest(“test.txt”)); // function progressHandler(evt:ProgressEvent):void { var \_percent:Number=0; \_percent=Math.round(evt.bytesLoaded/evt.bytesTotal\*100); trace(evt.bytesLoaded); trace(evt.bytesTotal); trace(\_percent+"%"); trace("--------------------"); mytxt\_txt.text=\_percent.toString(); } // function completeHandler(evt:Event):void { mytxt\_txt.text=\_txtloader.data; }

simulate download and in the trace windows:

## 65536 529995 12%

## 131072 529995 25%

## 196608 529995 37%

## 262144 529995 49%

## 327680 529995 62%

## 393216 529995 74%

## 458752 529995 87%

## 524288 529995 99%

## 529995 529995 100%

ⓂⓂⓂⓂ  
Anybody have an idea why?
