Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : menuBar Component Breaks Button


dmccoy
6/23/2004 8:56:30 PM
Version: FlashMX Professional 7.0.1

I am using the menuBar component and the "gel" buttons from the Flash Buttons
Library. When the movie first loads, the buttons work as expected. But after I
click on the menuBar, the buttons function erratically. Has anyone else seen
this? Any suggestions?

SWF file:
http://education.dental.ufl.edu/flash/menu-button_test.swf

// AS Code

var viewNavListener = new Object();

viewNavListener.change = function (eventObj) {
var theMenu = eventObj.menu;
var theMenuItem = eventObj.menuItem;
itemName = theMenuItem.attributes.instanceName;
trace(itemName + " called");
}

var viewNav = myMenu.addMenu("Image View");
viewNav.addMenuItem({label:"Zoom In (+)", instanceName:"zoomIn", id:"1"});
viewNav.addMenuItem({label:"Zoom Out (-)", instanceName:"zoomOut", id:"2"});
viewNav.addMenuItem({label:"Fit in Window (Ctrl+0)",
instanceName:"imageResize", id:"0"});

viewNav.addEventListener("change", viewNavListener);

var count = 0;

myButton.onPress = function () {
count++;
trace("Button pressed: " + count);
}
pao1011
6/23/2004 9:58:35 PM
I just test your code in a new movie and seems to work fine except that is not
target to get. I mean, you need the picture to zoom and do a code for the
zooming into the event listener.
If is something else that supposed to do let me know..maybe I can help.
Pao...
dmccoy
6/24/2004 12:53:56 PM
Thanks for your reply.

Actually the Zoom function works fine. I left that part out for simplicity
sake. My problem is with the buttons. You'll notice that when the movie first
loads, the "over" state on the button is active as long as your mouse is over
the button. You can leave the mouse stationary and click the button repeatedly,
and the button always returns to the "over" state. However, if you choose an
item from the menuBar, the button behavior changes. Now, the "over" state is
activated when you position your mouse over the button initially. BUT, after
you click the button -- as long as your cursor is stationary -- the button
becomes inactive (no "over" state activated). If you click again, the "over"
state is activated, but NOT the "down" state. If you double-click the button,
you can activate the "over" state and the "down" state in two rapid clicks.

I hope this makes sense.

pao1011
6/25/2004 12:24:20 AM
This is because the MenuBar behave like the menu on top of this browser, File,
Edit, View etc. Just open submenus after you click so you need to click again
to to close the menus not on mouseout like any other menu. So... to change that
you most make a new MenuBar component with the new event hadlers... I hope this
is what you mean...
AddThis Social Bookmark Button