2013-11-20 36 views
0

着接取方法goToAndStop在我的主FLA file`s庫我有一個叫做進度和AS聯動也被定義爲影片剪輯進度。AS3:從包裝

然後創建ProgressBar.as文件。見下文。當我使用這個類,我得到的錯誤ProgressBar.as, Line 17 1061: Call to a possibly undefined method goToAndStop through a reference with static type ProgressBar.

用法:

var PBar:ProgressBar = new ProgressBar(); 
addChild(PBar); 
PBar.setProgress(10); // gives Error 

ProgressBar.as

package 
{ 
    import flash.display.MovieClip; 
    public class ProgressBar extends MovieClip 
    { 
     private var movie:MovieClip; 
     public function ProgressBar() { 
      //set initial position 
      setPosition(400,400); 
     } 
     public function setPosition(X:Number,Y:Number):void{ 
      this.x=X; 
      this.y=Y; 
     } 
     public function setProgress(value:Number):void{ 
       var progress = Math.round(value); 
       this.goToAndStop(5); 
     } 
    } 
} 

回答