To help me with learning to program AS3 (I’m a complete newb), I am making a photo album with a button that rotates the images. The problem I’m having is, the button’s numbered click event is repeated so it I get a warning about a duplicate:
stop();
hb_btn.addEventListener(MouseEvent.CLICK, click1)
hb2_btn.addEventListener(MouseEvent.CLICK, click2)
hb3_btn.addEventListener(MouseEvent.CLICK, click3)
hb4_btn.addEventListener(MouseEvent.CLICK, click4)
function click1 (evt) {
var url = “http://www.URL1.com”
navigateToURL(new URLRequest(url))
}
function click2 (evt) {
var url = “http://www.URL2.com”
navigateToURL(new URLRequest(url))
}
function click3 (evt) {
var url = “http://www.URL3.com”
navigateToURL(new URLRequest(url))
}
function click4 (evt) {
gotoAndPlay (47)
}
Frame 47 rotates the images and stops with this code:
stop();
hb_btn.addEventListener(MouseEvent.CLICK, click1)
hb2_btn.addEventListener(MouseEvent.CLICK, click2)
hb3_btn.addEventListener(MouseEvent.CLICK, click3)
hb4_btn.addEventListener(MouseEvent.CLICK, click4)
function click1 (evt) {
var url = “http://www.URL4.com/”
navigateToURL(new URLRequest(url))
}
function click2 (evt) {
var url = “http://www.URL5.com”
navigateToURL(new URLRequest(url))
}
function click3 (evt) {
var url = “http://www.URL6.com/”
navigateToURL(new URLRequest(url))
}
function click4 (evt) {
gotoAndPlay (54)
}
So, because of the duplicate error, I gave each new set a new set of click event numbers. That fixed the error. Problem was, when I loop back to the beginning from the end frame, it won’t play and just loops the last frame.
What I need to do is find a way to reset the numbered click event so I can reuse the click1, click2, click3 and click4. Is there a way to reset the value so I can reuse it?