There are a couple ways you could tackle this...although it depends on what
kind of object you're using (button component, movie clip etc). If you're using
button components, the event listener model is the way to go. The evtObj
parameter that the function takes is passed in automatically:
buttonListener = new Object();
buttonListener.click = function (evtObj:Object) {
if (evtObj.target._name == "home_btn") {
getURL("home.html", "_self");
}else if (evtObj.target._name == "contact_btn") {
getURL("contact.html", "_self");
}
}
home_btn.addEventListener("click", buttonListener);
contact_btn.addEventListener("click", buttonListener);
If you're using a movie clip you could use this code (inside the button movie
clip) to perform the same operation:
//home movie clip
this.onRelease = function () {
getURL("home.html", "_self");
}
//contact movie clip
this.onRelease = function () {
getURL("contact.html", "_self");
}
Hope that helps!
Galeo Designs - 30 Jun 2006 17:12 GMT
Thank You.
I have entered the code in the frame where the buttons are located. and
nothing happens when I view the webpage.
I have changed the names of the button symbols to '(name)_btn'
What else should I be doing?
Sorry, I am completely new to this and trying to get my head around everything.