I'm trying to make three buttons in Adobe Animate, using ActionScript. Here is the code I'm using for button 1:
button. addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new
URLRequest("https://website.com/"));
}
button2. addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler2(event:MouseEvent):void {
navigateToURL(new
URLRequest("https://anotherwebsite.com/"));
}
button3. addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler3(event:MouseEvent):void {
navigateToURL(new
URLRequest("https://yetanotherwebsite.com/"));
}
(The URLs are made up and only for demonstration purposes.) The code for button 2 and 3, as you can see, are exactly the same but on different layers. I also change the instance name at the start, the function name, and the URL for each button. But when I press CTRL + Enter, all the buttons lead to the same webpage (in this case "website.com"), which is the one I put in first. It should lead to the different URLs I put in, but they all just go to the same one. Why is this happening and how do I fix this?