Copy link to clipboard
Copied
I'm very new to actionscript3 and am working on a project where I have a single scene and two buttons to progress through this scene. When I test the movie the buttons do not carry out my programmed functions but are recognized as being pressed. I'm receiving an error 1010 stating:
TypeError: Error #1010: A term is undefined and has no properties.
at Function/Sunrise/$construct/playTimeline1()
TypeError: Error #1010: A term is undefined and has no properties.
at Function/Sunrise/$construct/playTimeline2()
Here is my code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;
public class Sunrise extends MovieClip{
public function Sunrise() {
// constructor code
function playTimeline1(event:MouseEvent): void {
this.Car.gotoAndPlay(2);
this.Bird.gotoAndPlay(2);
this.Stars.gotoAndPlay(2);
this.Sunrise.gotoAndPlay(2);
this.Man.gotoAndPlay(2);
this.Sky.gotoAndPlay(2);
}
button1.addEventListener(MouseEvent.MOUSE_DOWN, playTimeline1);
function playTimeline2(event:MouseEvent): void {
this.Car.gotoAndPlay(25);
this.Stars.gotoAndPlay(25);
this.Bird.gotoAndPlay(25);
this.Sunrise.gotoAndPlay(25);
this.Man.gotoAndPlay(25);
this.Sky.gotoAndPlay(25);
}
button2.addEventListener(MouseEvent.MOUSE_DOWN, playTimeline2);
}
}
}
Thank you for your time
Copy link to clipboard
Copied
click file>publish settings>swf and tick 'permit debugging'. retest.
the problematic line of code referencing a non-existent object will be in the error message.
Copy link to clipboard
Copied
I see that you already have permit debugging. Look at lines 13 and 23 in the code, it's quite likely the same movieclip. Check the name of it in Properties to make sure it matches the name in the code.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more