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

How to use gotoandplay scene link using class property (external code.as)

Explorer ,
Dec 24, 2012 Dec 24, 2012

Hello

I am using ‘gotoandplay’ scene by scene link using this code. If I use this in the same time line (internal), it’s working properly but when I use this code in as a class, I got this error

Call to a possibly undefined method MovieClip.

I use this code in time timeline

b_enter.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_enter1);

function fl_ClickToGoToScene_enter1(event:MouseEvent):void

{

            MovieClip(this.root).gotoAndPlay("p menu", "Menu");

}

I use this code in class

package  {

           

            import flash.display.SimpleButton;

           

           

            public class next extends SimpleButton {

                       

                       

                        public function next() {

                                    // constructor code

                                    MovieClip(this.root).gotoAndStop("p2", "page2")

                        }

            }

           

}

u can download the flash file using this link

http://www.delta-adv.com/nav/np.rar

TOPICS
ActionScript
9.3K
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

correct answers 1 Correct answer

Community Expert , Dec 29, 2012 Dec 29, 2012

:

package {

    import flash.display.SimpleButton;

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    import flash.events.Event;

    public class np extends SimpleButton {

       

        var _root:MovieClip;

        public function np() {

            this.addEventListener(Event.ADDED_TO_STAGE,init);

            this.addEventListener(MouseEvent.CLICK,nextF);

        }

        private function init(e:Event):void{

            _root = MovieClip(this.root);

        }

        private functi

...
Translate
Community Expert ,
Jan 05, 2013 Jan 05, 2013

that's not the code being used by flash.  you need to save that file, then test.

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 ,
Jan 05, 2013 Jan 05, 2013

thx boss. its working

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 ,
Jan 05, 2013 Jan 05, 2013
LATEST

you're welcome.

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