django
django

Reputation: 2909

AS3: cant acess method goToAndStop from package

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

Answers (1)

ndm
ndm

Reputation: 60463

This is because goto has to be all lowercase, ie gotoAndStop() instead of goToAndStop().

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/MovieClip.html#gotoAndStop()

Upvotes: 1

Related Questions