Hi, I'm having a bit of a problem with the MenuBar component in Flash. Using Flash 8 Pro. I've set up a MenuBar as scripted below using XML as the source. The menu works fine apart from the fact that I cannot Tab to it as I can other items in my system. I've removed Flash's built in focusManager as one has been written for this project. The following line adds the menubar to the custom focus management object in the same way as the other things in the system but it just doesn't want to be tabbed to. Any ideas why this might be? root.FocusManagementObj.registerScreenElement(xmlMenuBar,"Program Menu Bar"); As I can't tab to it, is it possible to set up keyboard shortcuts to the menu in a similar way to the usual Alt-F for the File item on most software menus? Regards, Gareth. =========================================================== // // Test code so far // // // // If we import the controls, we can then use createClassObject, as seen // a few lines down, to create a MenuBar without actually having to place // a MenuBar component on the stage. import mx.controls.MenuBar; import mx.controls.Menu; import mx.events.EventDispatcher; import mx.utils.Delegate; import learningobject.view.FocusManagement; // ==================================================================== //var FocusManagementObj:FocusManagement; //_root.focusManager.tabEnabled = false; _root.focusManager.removeMovieClip(); // ==================================================================== // Create a MenuBar object on the screen this.createClassObject(mx.controls.MenuBar, "xmlMenuBar", 25); // XML var myDP_xml:XML; // Listener object var fileListener:Object; // ==================================================================== // Set up tab index etc. xmlMenuBar.tabEnabled = true; //xmlMenuBar.tabIndex = 1; _root.FocusManagementObj.registerScreenElement(xmlMenuBar,"Program Menu Bar"); trace("MENU--MENU--MENU"); // ==================================================================== //define styles for the ComboBox component xmlMenuBar.setStyle("backgroundColor", 0xD8CCB6); //xmlMenuBar.setStyle("alternatingRowColors", [0xE9E1D6, 0xCEBEA6]); xmlMenuBar.setStyle("color", 0x666666); xmlMenuBar.setStyle("embedFonts", false); xmlMenuBar.setStyle("textAlign", "left"); //xmlMenuBar.setStyle("fontStyle", "italic"); // ==================================================================== myDP_xml = new XML(); myDP_xml.ignoreWhite = true; myDP_xml.onLoad = function(success:Boolean) { if (success) { // Set the size and position of the menu using XML values xmlMenuBar._height = myDP_xml.firstChild.nextSibling.attributes.menuHeight; xmlMenuBar._width = myDP_xml.firstChild.nextSibling.attributes.menuWidth; xmlMenuBar._x = myDP_xml.firstChild.nextSibling.attributes.xPos; xmlMenuBar._y = myDP_xml.firstChild.nextSibling.attributes.yPos; // // set some of the style values from XML data xmlMenuBar.setStyle("fontFamily", myDP_xml.firstChild.nextSibling.attributes.menuFont); xmlMenuBar.setStyle("fontSize", myDP_xml.firstChild.nextSibling.attributes.menuFontSize); xmlMenuBar.setStyle("themeColor", myDP_xml.firstChild.nextSibling.attributes.menuColour); // // populate the menu with the XML values xmlMenuBar.dataProvider = myDP_xml.firstChild; //trace(myDP_xml.firstChild); } else { trace("error loading XML file"); } }; myDP_xml.load("menuBarXML.xml"); // // The listenered for the file menu (and submenus) fileListener = new Object(); fileListener.change = function(eventObj:Object):Void { eventObj.menuItem.attributes.selected = "true"; xmlMenuBar.setMenuItemSelected(eventObj.menuItem, true); eventObj.menu.refresh(); //trace(eventObj.menuItem.attributes.label); // //var menuNum = eventObj.menu._name; //trace(menuNum); // //var menuItemNum = eventObj.menu.indexOf(eventObj.menuItem); //trace(menuItemNum); // //eventObj.menu.TextArea.setStyle("fontStyle", "italic"); // //var myItem:mx.controls.Menu = eventObj.menu.getMenuItemAt(menuItemNum); //trace(myItem); //trace(eventObj.menu.getMenuItemAt(menuItemNum)); //trace("getMenuAt -> "+xmlMenuBar.getMenuAt(menuItemNum)); //var instName = eventObj.menuItem.attributes.instanceName; // //eventObj.menuItem.attributes.selected = "true"; // //xmlMenuBar.setMenuItemSelected(eventObj.menuItem, true); // switch(eventObj.menuItem.attributes.linkType) { case "web": //getURL(eventObj.menuItem.attributes.linkTo, "_blank"); break; case "email": //getURL("mailto:"+eventObj.menuItem.attributes.linkTo <mailto:> , "_blank"); break; case "keyframe": //gotoAndPlay(eventObj.menuItem.attributes.linkTo); break; case "exit": getURL("javascript:closeWindow()"); break; } }; // register the listeners with the separate menus xmlMenuBar.addEventListener("change", fileListener);
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com