Your code is perfectly good. You HAVE given your buttons instance names: ChoiceBtn1, ChoiceBtn2 and ChoiceBtn3 in the properties panel, right? What do you mean "...flash is acting like it does not exist." What is the IT?
AS3 Interactive Story Choice Button
-
14-07-2023 - |
Question
I'll admit, I am a n00b in AS3. My question is this. I'm making an interactive novel, where I'm using movieClip as choice buttons because they offer a bit more control. I am trying to get them to respond to mouse events so that it becomes more responsive to the user (like a highlight) by going to another frame inside the movieClip of the ChoiceBtn's. This is the code I came up with and flash is acting like it does not exist.
ChoiceBtn1.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn1.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn1.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);
ChoiceBtn2.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn2.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn2.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);
ChoiceBtn3.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn3.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn3.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);
function mouse_Over (event: MouseEvent):void
{
event.target.gotoAndStop(2);
}
function mouse_Down (event: MouseEvent):void
{
event.target.gotoAndStop(3);
}
function mouse_Out (event: MouseEvent):void
{
event.target.gotoAndStop(1);
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow