|
-
anyone else hear that?
Multiple event listeners
I've got 5 buttons (btn1_mc, btn2_mc, etc.) that I need to assign the same listeners to for the RollOver and RollOut to go to frame 2 and back to 1, and I'm sure there's a better way to do it than this, but I can't get it working...
I started with:
Code:
nav1_mc.nav2_mc.btn1_mc.addEventListener(MouseEvent.CLICK, slidePanelOutClick);
nav1_mc.nav2_mc.btn1_mc.addEventListener(MouseEvent.MOUSE_OVER, nav2RollOver);
nav1_mc.nav2_mc.btn2_mc.addEventListener(MouseEvent.MOUSE_OVER, nav2RollOver);
nav1_mc.nav2_mc.btn3_mc.addEventListener(MouseEvent.MOUSE_OVER, nav2RollOver);
nav1_mc.nav2_mc.btn4_mc.addEventListener(MouseEvent.MOUSE_OVER, nav2RollOver);
nav1_mc.nav2_mc.btn5_mc.addEventListener(MouseEvent.MOUSE_OVER, nav2RollOver);
nav1_mc.nav2_mc.btn1_mc.addEventListener(MouseEvent.MOUSE_OUT, nav2RollOut);
nav1_mc.nav2_mc.btn2_mc.addEventListener(MouseEvent.MOUSE_OUT, nav2RollOut);
nav1_mc.nav2_mc.btn3_mc.addEventListener(MouseEvent.MOUSE_OUT, nav2RollOut);
nav1_mc.nav2_mc.btn4_mc.addEventListener(MouseEvent.MOUSE_OUT, nav2RollOut);
nav1_mc.nav2_mc.btn5_mc.addEventListener(MouseEvent.MOUSE_OUT, nav2RollOut);
back_mc.addEventListener(MouseEvent.CLICK, backOut);
function nav2RollOver(mevt:MouseEvent):void {
trace("MOUSE_OVER "+mevt.currentTarget.name);
nav1_mc.nav2_mc.btn1_mc.gotoAndStop(2); //this was the only way it worked, but only on the one clip
//mevt.currentTarget.name.gotoAndStop(2);
//mevt.currentTarget.gotoAndStop(2);
}
function nav2RollOut(mevt:MouseEvent):void {
nav1_mc.nav2_mc.btn1_mc.gotoAndStop(1);
}
It only seems to work when you roll completely off a clip and back on and it just flashes the rollover, it doesn't stay on frame 2?? If I roll from one item right to the other, it doesn't trigger the trace on the successive objects...
There's GOT to be an easier way to do this....
Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|