-
AS3 + Buttons
I'm trying to do a button within a button for my navbar. For this button, the bottom layer contains a movie clip that fades in when the primary button clip is moused over. Theres also a layer with a movieclip that contains all of the navbars actual buttons on top of the fade in clip, they extend through all 4 stages. I think i'm having a problem with which item is in focus, because either nothing happens when i click on them because the parent button steal the click, or when i bring the button clip out of the main button movie clip, and place it on top, flash focuses on the sub buttons, and fails to animated the bottom layer.
Is there a way to specify to keep the bottom clip on the _over stage, but still allow buttons which are placed above them to be clickable?
-
You are in the wrong forum buddy, the AS 3.0 forum is right after the next corner. ;) But anyways, if you want to disable the children of a movie clip then you could simply use yourMovieClip.mouseChildren = false; that will prevent the children of the parent from reacting to any mouse events.
-
would that disable MouseEvent.Click ?
(sorry didnt know if it was an AS3 question or a basic flash index ordering question)
-
Well, the thread title says "AS3 + buttons" ... are you using AS 3.0 or 2.0 ? Because you got me confused...
-
AS3 with the nested buttons being activated instance.buttonmode = true;
-
Could you maybe post the .fla so I can take a look at it ? It would be much easier because I'm not totally getting your problem... on the other hand, as a friendly advice: DON'T USE BUTTONS !!! USE ONLY MOVIE CLIP !!!
Button symbols are evil, bad, limited and crap. All that you'll ever need are called Movie Clips, you can do whatever you want with them.
-
1 Attachment(s)
-
wont let me upload the .as file -
package {
import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.text.*;
public class buttonTest2 extends MovieClip {
public var sfgovStat:Boolean = false;
// create a new LocalConnection instance used to send
// calls to a LocalConnection instance in another movie
var outgoing_lc:LocalConnection = new LocalConnection();
public function buttonTest2() {
btn1.buttonMode = true;
btn2.buttonMode = true;
btn3.buttonMode = true;
bg.buttonMode = true;
btn1.addEventListener(MouseEvent.CLICK, myTrace);
btn2.addEventListener(MouseEvent.CLICK, myTrace);
btn3.addEventListener(MouseEvent.CLICK, myTrace);
bg.gotoAndStop(1);
bg.addEventListener(MouseEvent.ROLL_OVER, myPlay);
bg.addEventListener(MouseEvent.ROLL_OUT, myRewind);
}
// event handler when the send button is clicked
function myTrace(event:MouseEvent):void {
trace("Home --> Click");
}
function myPlay(event:MouseEvent):void {
if (!sfgovStat) {
trace("false");
bg.play();
sfgovStat = true;
} else {
}
}
function myRewind(event:MouseEvent):void {
trace("Mouse Out goto and play 20");
bg.gotoAndPlay(20);
sfgovStat = false;
}
}
}