ActionScript - Controls Show/Hide on MouseOver/MouseOut
Hi, all!
I currently have a simple play/pause button named "pp" with a two-frame structure as follows:
Frame 1:
stop();
btn_2.addEventListener (MouseEvent.CLICK, stopplaying);
function stopplaying(e:MouseEvent):void {
MovieClip(root).stop();
stop();
gotoAndStop(2);
}
Frame 2:
stop();
btn_1.addEventListener (MouseEvent.CLICK, startplaying);
function startplaying(e:MouseEvent):void {
MovieClip(root).play();
play();
}
There's also a transparent square called "backpp" that triggers showing/hiding the play/pause button on mouseevents. The code looks like this:
var btn_1, btn_2;
pp.visible = false;
backpp.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
backpp.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
function mouseOver(e:Event):void {
//show the buttons if they exist
//if(btn_1) btn_1.visible = true;
//if(btn_2) btn_2.visible = true;
if(pp) pp.visible = true;
}
function mouseOut(e:Event):void {
//hide the buttons if they exist
//if(btn_1) btn_1.visible = false;
//if(btn_2) btn_2.visible = false;
if(pp) pp.visible = false;
}
So, my question: whenever I don't have the mouseevent code that shows/hides the playback controls, the controls work perfectly. When I do introduce the show/hide code, the controls show and hide perfectly, but the playback controls no longer function - they essentially become a dumby graphic. Any insight would be hugely appreciated!
