Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ProgressBar problem

Community Beginner ,
Jul 31, 2009 Jul 31, 2009

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??

TOPICS
ActionScript
441
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2009 Jul 31, 2009

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 caricati

    bar.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??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 31, 2009 Jul 31, 2009
LATEST

got it, l did a mistake when l remove The listener from stage (wrote "loading" instead of leading2)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 31, 2009 Jul 31, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines