Question
Flash button with dynamic text
I'm trying to create a flash button so that it can toggle
between "Sound On" and "Sound Off" but I feel like I'm doing
something wrong and it errors out on me.
I have a button on stage as, and in my up/over/down/hit in different colors I have a dynamic text field identified as sound_txt.
Here's the script I have so far for my frame:
stop();
mutebtn.addEventListener(MouseEvent.CLICK,muteDo);
function muteDo(event:MouseEvent) {
if (mutebtn.sound_txt.text == "Sound Off") {
mutebtn.sound_txt.text = "Sound On";
} else {
mutebtn.sound_txt.text = "Sound Off";
}
}
and this is the error message I am getting:
TypeError: Error #1010: A term is undefined and has no properties.
at buttontst_fla::MainTimeline/muteDo()
TypeError: Error #1010: A term is undefined and has no properties.
at buttontst_fla::MainTimeline/muteDo()
Can someboy please advise as to how I can get this to work?
I have a button on stage as, and in my up/over/down/hit in different colors I have a dynamic text field identified as sound_txt.
Here's the script I have so far for my frame:
stop();
mutebtn.addEventListener(MouseEvent.CLICK,muteDo);
function muteDo(event:MouseEvent) {
if (mutebtn.sound_txt.text == "Sound Off") {
mutebtn.sound_txt.text = "Sound On";
} else {
mutebtn.sound_txt.text = "Sound Off";
}
}
and this is the error message I am getting:
TypeError: Error #1010: A term is undefined and has no properties.
at buttontst_fla::MainTimeline/muteDo()
TypeError: Error #1010: A term is undefined and has no properties.
at buttontst_fla::MainTimeline/muteDo()
Can someboy please advise as to how I can get this to work?
