0
votes

How do I fix this Error #1010: : A term is undefined and has no properties. at Main/showIntro() at Main(). The code that I used is from a online tutorial.

package {
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.display.MovieClip;

    public class Main extends MovieClip {
        private var intro:Introduction;

            public function Main() {
                intro = new Introduction();

                showIntro();
            }

            private function showIntro():void {
                //add intro
                addChild(intro);
                //add eventlistener
                intro.begin_btn.addEventListener(MouseEvent.CLICK, clickBegin);
                intro.x = stage.stageWidth/2;
                intro.y = stage.stageHeight/2;
            }

            private function clickBegin(e:MouseEvent):void {
                trace("0");
            }
        }
    }
}
1
What line does the error happen on? Does intro.begin_btn actually exist?h2ooooooo
What is Introdction? Did you include the Class somewhere?putvande
Most likely you didn't name buttons of Introduction class correctly. Check if the "begin" button is named begin_btn, if not, correct that.Vesper
'begin' button is named begin_btnuser3181632
The problem is that flash don't indicates a error line.user3181632

1 Answers

0
votes

I'm pretty sure this is because begin_btn isn't defined in the Introduction class when you instantiate it.

Try adding a definition in the class like so:

public var begin_btn:MovieClip;

If you have defined it, check that it is a publicly accessible