all groups > flash actionscript > may 2005 >
You're in the

flash actionscript

group:

menuBar component breaks buttons



menuBar component breaks buttons Qasper
5/23/2005 11:29:21 AM
flash actionscript: Interacting with the menubar component breaks buttons. After doing the
following basic setup, a button works fine until you interact with the
menubar. After that, the button receives "rollOut" instead of
"release" when you click it without moving the mouse.
Try it:
1) Create a new menuBar instance named myMenuBar.
2) Create a new button instance.

Add menus to the menubar from an actions layer:
_root.menu1 = myMenuBar.addMenu("Topics");
_root.menu2 = myMenuBar.addMenu("Pages");

On the button, trace the mouse events:
on (rollOver) {
trace("OVER");
}
on (rollOut) {
trace("OUT");
}
on (release) {
trace("RELEASE");
}
on (press) {
trace("DOWN");
}

After interacting with the menubar, the button incorrectly reports the
mouse events while the mouse is stationary over it. It no longer
reports "down" and "release" after the first click.

Result:
OVER
DOWN
RELEASE
OUT
OVER
OUT
OVER
OUT
OVER
OUT

Solutions?
Thanks,
Jason
Re: menuBar component breaks buttons Qasper
6/10/2005 1:51:38 PM
For the record, here is the solution to this problem.

You mentioned that the button loses focus on the button event once you
have selected the MenuBar component. There are similar issues that were
reported by other customers and it seems that the primitive buttons do
encounter such conflict when it is combined with the Flash components.
One solution would be to use a button component rather than a primitive
button symbol; another workaround that you can try is creating an
Actionscript that will force the Flash player to set the focus on the
selected item. You may try the script below and place it on the
keyFrame of your Flash document; there is a possibility that it might
not work due to the design that you are implementing. However, it is
still worth trying.

myBtn1.onPress = function (){
this._focusrect = false;
Selection.setFocus(myBtn1)
}

Note: myBtn1 would be the instance of your button symbol.

I hope this information helps.
AddThis Social Bookmark Button