Search code examples
actionscript-3

TypeError: Error #1010: A term is undefined and has no properties?


Error:

TypeError: Error #1010: A term is undefined and has no properties. at Untitled_2_fla::MainTimeline/frame1()[Untitled_2_fla.MainTimeline::frame1:4]

Can't seem to figure out what's that about.

Here's my code:

import flash.events.MouseEvent;
btnMc1.txtSourceMc.gotoAndStop();
btnMc1.addEventListener(MouseEvent.ROLL_OVER, over);
btnMc1.addEventListener(MouseEvent.ROLL_OUT, out);
function over(e: MouseEvent) {
    btnMc1.buttonMode = true;
    btnMc1.gotoAndPlay(1);
}
function out(e: MouseEvent) { 
    btnMc1.gotoAndPlay(62);
}

Solution

  • You need to create the variable btnMc1, such as var btnMc1 And you're going to have to give it a class such as var btnMc1:

    whatEverObjectICreated = new whatEverObjectICreated;