Hey guys!
I’m really new to AS3 so my apologies in advance.
What I’m trying to do is have a website where there are menu buttons on the sides and when you Mouse Over any of the buttons, the picture in the middle changes. Ideally I’d like to set it up so that the image in the center stays until the next button is touched and then it is removed and replaced with another button. Now I could manage this inside the timeline, but it would take a very long time so I’m trying to figure out how to do this with AS3.
This first bit of code I used was as follows:
home_btn.addEventListener(MouseEvent.MOUSE_OVER,HomeShow);
home_btn.addEventListener(MouseEvent.MOUSE_OUT,HomeHide);
function HomeShow (Event:MouseEvent):void {
pic_home_btn.alpha =1;
}
function HomeHide (Event:MouseEvent):void {
pic_home_btn.alpha =0;
}
This worked well enough… when you mouse over the home button, its associated picture appears and disappears when you mouse out. Now my problem with this however is that there are 10 buttons on the page, each with their own center MC image and I don’t want to have to create 10 different functions for the same thing.
What I was hoping someone would know how to do is change the mc target by taking the name of the button that is being pressed (evtObj.target.name) append the word “_pic” to it and the alpha of the movie clip with the same name would change. IE: mouse over the button “home_button” and the movie clip “home_button_pic” would appear.
Also, like I said earlier, ideally I’d rather the image remain visible until another button is pressed instead of disappearing on MOUSE_OUT but I have no idea how to do this.
Any help would be greatly appreciated!