Reputation: 2909
In my Main FLA file`s library I have a movieclip which is named ProgressBar and AS linkage is also defined as ProgressBar.
Then I created ProgressBar.as file. see below. When i use this class, I get the error ProgressBar.as, Line 17 1061: Call to a possibly undefined method goToAndStop through a reference with static type ProgressBar.
USAGE:
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);
}
}
}
Upvotes: 0
Views: 62
Reputation: 60463
This is because goto
has to be all lowercase, ie gotoAndStop()
instead of goToAndStop()
.
Upvotes: 1