Hi,
Can anyone tell me what’s the problem with this code ?
var dataTextField:TLFTextField=new TLFTextField();
addChild(dataTextField);
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void
{
var loadedBytes:int = Math.round(e.target.bytesLoaded / 1024);
var totalBytes:int = Math.round(e.target.bytesTotal / 1024);
var percent:int = (e.target.bytesLoaded / e.target.bytesTotal) * 100;
dataTextField.text = String(loadedBytes + " of " + totalBytes + "KB Loaded
" + percent + "% Complete");
}
function onComplete(e:Event):void
{ this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
play();
}
it’s a preloading code and it’s simple, the code used to be with “TextField” and it worked OK, then I changed it to be with “TLFTextField” class but it doesn’t work now.
Maybe the solution is simple but I’m not familiar with the new “TLFTextField” class :ne: