jeudi 15 septembre 2016

ASC3 extending a custom class with MovieClip - gotoAndStop not working

I'm trying to setup a class that handles screen navigation for a game; called MenuNavigation. I have extended this class with MovieClip so I should** be able to access gotoAndStop functions, but I keep getting the error - "1180 - Access of undefined method gotoAndStop". I have also tried:

MovieClip(root).gotoAndStop(frameLabel)
MovieClip(root).gotoAndStop(frameLabel)
Stage.gotoAndStop(frameLabel)"

these do not work either. I have made a few other classes that have extended MovieClip would be this be an issue? is there a limit? Its weird iv done other flash projects and done the exact same thing and never had an issue. I'm sure its something stupid on by behalf. Thanks

Here is the code:

package  
{
    import flash.display.*;
    import flash.events.*;

    public class MenuNavigation extends MovieClip 
    {

        public function MenuNavigation() 
        {
            // constructor code
        }

        // function deals with button navigation handling between frames
        public static function loadScreen(evt:MouseEvent)
        {
           switch(evt.target.name)
            {
                case "playButton":
                    gotoAndStop("aboutGame");
                break;
                case "creditsButton":
                    gotoAndStop("credits");
                break;
                case "aboutNextButton":
                    gotoAndStop("instructions");
                break;
                case "aboutBackButton":
                    gotoAndStop("mainMenu");
                break;
                case "instructionsBackButton":
                    gotoAndStop("aboutGame");
                break;
                case "instructionsPlayButton":
                    gotoAndStop("game");
                break;
                case "creditsBackButton":
                    gotoAndStop("mainMenu");
                break;
            }
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire