Copy link to clipboard
Copied
im new at as3 and i keep getting this error
TypeError: Error #1010: A term is undefined and has no properties.
at Untitled_2_fla::MainTimeline/frame1()[Untitled_2_fla.MainTimeline::frame1:4]
and i've search the net for more than a day for solution but i still cant get it
and here is 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);
}
can anybody help me solve it?
Copy link to clipboard
Copied
if btnMc1.txtSourceMc.gotoAndStop(); is line 4,
btnMc1 or
btnMc1.txtSourceMc
doesn't exist when your code executes.
after you fix that you'll hit another error: you need a frame number or label in your goto
Copy link to clipboard
Copied
I'm not really sure what the txtSourceMc is doing there. Is that a movie within another movie? If it is, the following two options would work for you.
btnMc1.txtSourceMc.gotoAndStop(1); // with a '1' or some other number
or this:
btnMc1.txtSourceMc.stop();
but judging from your code, I think you need this:
import flash.events.MouseEvent;
btnMc1.stop();
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);
}
Good luck
Find more inspiration, events, and resources on the new Adobe Community
Explore Now