[Flashcoders] Help - Are keyboard shortcuts possible for MenuBarcomponent?
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, 0x66); 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
[Flashcoders] FW: Are keyboard shortcuts possible for MenuBar component?
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, 0x66); 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
RE: [Flashcoders] Multi-dimensional array problems in classes
Thanks everyone for the assistance as it has helped me to get it working. Regards, Gareth. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of slangeberg Sent: 20 January 2007 20:42 To: Flashcoders mailing list Subject: Re: [Flashcoders] Multi-dimensional array problems in classes I agree with previous, however, it is good to deal with references in classes. Best design for your 2D array depends on what it's intended for?: var reactionStoichiometry:Array = new Array (); public function addItem( newArr:Array ):Number { //returns len(?) return reactionStoichiometry.push( newArr ); } used like: var yorObject:YourClass = new YourClass(); var newArr:Array = new Array (1, 3, 2, 0), yorObject.addItem( newArr ); yorObject.addItem( new Array( 1,2,1,0 ) ); ...etc -Scott On 1/20/07, Ron Wheeler [EMAIL PROTECTED] wrote: BTW, Classes love Objects of all types regardless of the arrays. Just a hint. Often multi-dimensional arrays are just crying out to be single arrays of objects and if their wish is granted, your code becomes amazingly small and elegant as your reward for granting their wish. Help make an array's wish become true!!! If you pass this on to 6 programmers in the next 24 hours, you will be granted good karma for a year. Ron Stan Vassilev wrote: When you assign dynamic or more complex values, and especially if you don't want this array to be shared (by reference) to all instances of the class, it's best to initialize in the constructor. There aren't any limitations on multidim. arrays in objects, classes, or objects in classes and so on. I suspect the particular syntax you used was not correct, hence your issues. It'd help to post this instead. Regards, Stan Vassilev - Original Message - From: Gareth Hudson [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Saturday, January 20, 2007 2:02 PM Subject: [Flashcoders] Multi-dimensional array problems in classes Hi there, Does anyone know if it we are supposed to use multi-dimensional arrays (an array consisting of arrays) within a class? If so, what is the best, legal way to create them? The only way I have managed to do it is by this method: var reactionStoichiometry:Array = new Array ( new Array (1, 3, 2, 0), new Array (1, 2, 1, 0), new Array (2, 1, 2, 0), new Array (2, 0, 1, 3), new Array (2, 0, 2, 1), new Array (1, 0, 1, 1), new Array (1, 1, 2, 0), new Array (1, 1, 2, 0), new Array (1, 1, 1, 1)); Any other ways of creating them give me a compile error saying that they are not allowed within a class. I need to assign these values dynamically, the above ones a for testing, and would prefer to do it by addressing the locations in the main array by position number for inserting the other arrays within it. Classes don't seem to like Objects containing arrays either. Many thanks, Gareth Hudson. ___ 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 ___ 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 ___ 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 -- : : ) Scott ___ 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 ___ 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
[Flashcoders] Flash MP3 recorder?
Does anyone know if it would be possible to have a browser based audio recorder within flash that would allow a user to use their microphone to record what they were saying as an MP3? Security issues within browsers make me think that it would be very difficult to achieve this. If it's possible I may be asked to incorporate it into a piece of language eLearning for users to send spoken recordings to tutors for marking as part of a course. The only items I've seen have mentioned use of a Flash Comms server, but I haven't had any experience in the area of audio recording with Flash as yet. Many thanks. Gareth Hudson. ___ 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
[Flashcoders] Multi-dimensional array problems in classes
Hi there, Does anyone know if it we are supposed to use multi-dimensional arrays (an array consisting of arrays) within a class? If so, what is the best, legal way to create them? The only way I have managed to do it is by this method: var reactionStoichiometry:Array = new Array ( new Array (1, 3, 2, 0), new Array (1, 2, 1, 0), new Array (2, 1, 2, 0), new Array (2, 0, 1, 3), new Array (2, 0, 2, 1), new Array (1, 0, 1, 1), new Array (1, 1, 2, 0), new Array (1, 1, 2, 0), new Array (1, 1, 1, 1)); Any other ways of creating them give me a compile error saying that they are not allowed within a class. I need to assign these values dynamically, the above ones a for testing, and would prefer to do it by addressing the locations in the main array by position number for inserting the other arrays within it. Classes don't seem to like Objects containing arrays either. Many thanks, Gareth Hudson. ___ 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
[Flashcoders] Need help setting setMenuItemSelected in XML MenuBar.
Hi everyone, Hopefully this posting won't affect the layout of the code in this message. If the layout does get all messed up again can someone let me know why that might be when posting a message? My problem is described again here. I have a problem with my MenuBar in the fact that I can get setMenuItemSelected to work. When items on the menu get a tick, I need them them to stay that way to show a visited state within the menu. I can't seem to address the correct item in the menu when using setMenuItemSelected and so the items just untick when selected again. Many thanks in advance to anyone who can help me fix this problem as I've spent far too long trying to sort it out. Here's my code, the menu uses and xml file to populate and everything else works fine: // 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; // // 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; // //define styles for the ComboBox component xmlMenuBar.setStyle(backgroundColor, 0xD8CCB6); //xmlMenuBar.setStyle(alternatingRowColors, [0xE9E1D6, 0xCEBEA6]); xmlMenuBar.setStyle(color, 0x66); 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 { trace(--); //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 = xmlMenuBar.getMenuItemAt(eventObj.menuItem); //trace(myItem); //trace(eventObj.menu); //trace(getMenuAt - +xmlMenuBar.getMenuAt(menuItemNum)); var instName = eventObj.menuItem.attributes.instanceName; trace(eventObj.menuItem.menuNum); // xmlMenuBar.setMenuItemSelected(menuNum.menuItemNum, 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; } }; // register the listeners with the separate menus xmlMenuBar.addEventListener(change, fileListener); stop(); Kind Regards, Gareth Hudson. ___ 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