ProgressBar problem
Copy link to clipboard
Copied
Hi,
i create a progress bar by my own. It has beem place din the forst frame of the stage (that's why stop() at first). The filler color is a MC named as "bar"
This is the AS manager:
stop();
this.addEventListener(Event.ENTER_FRAME, loading2);
function loading2(e:Event):void {
var total : Number = this.stage.loaderInfo.bytesTotal; //carica il numero di B totali
var loaded : Number = this.stage.loaderInfo.bytesLoaded;//cAarica il numero di B caricati
bar.scaleX = loaded/total;
showProgr.text = Math.floor((loaded/total)*100)+ "%";
if (total == loaded) {
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
But it give to me error 1009 on the "+" row caused by bar and showProgr. Of course these instance as named as in AS code.So Why this error??
Copy link to clipboard
Copied
try:
stop();
this.addEventListener(Event.ENTER_FRAME, loading2);
function loading2(e:Event):void {
var total : Number = this.stage.loaderInfo.bytesTotal; //carica il numero di B totali
var loaded : Number = this.stage.loaderInfo.bytesLoaded;//cAarica il numero di B caricatibar.scaleX = loaded/total;
showProgr.text = Math.floor((loaded/total)*100).toString()+ "%";if (total == loaded) {
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}}
But it give to me error 1009 on the "+" row caused by bar and showProgr. Of course these instance as named as in AS code.So Why this error??
Copy link to clipboard
Copied
got it, l did a mistake when l remove The listener from stage (wrote "loading" instead of leading2)
Copy link to clipboard
Copied
If you're saying that error is caused by the line:
showProgr.text = Math.floor((loaded/total)*100)+ "%";
I would double check that showProgr actually exists by just calling trace(showProgr). If it traces null or undefined, then double check to make sure your instance name of the instance on stage matches the code.

