Function key Icon renderer for flex menus
You might have noticd from the past few posts I have been working on a UI for a .Net application. I got a little enthused last night and made an icon itemRenderer for the Flex Menu class. What the heck is that? Well you know in menus how you sometimes see "F2" next to a menu item, that is the shortCut key, well this class places that in the icon area of the menu :: see below.
Note also that I also made a windows style ctrl shortCut key labelRenderer aswell. When working in Visual Studio making a windows form application you typically put a "&" infront of the key to be pressed with the "ctrl" key which is the shortCut key. ie "&File" would appear in the actuall application menu as File. So in you label field in your xml or Array just put the label as "&File" or "Som&e short cut" and it will take care of the rest.
As with any release there could be bugs etc so if you find any let me know. To view the source of or download the source click the links.
Unfortunately there is nothing that I know of in flex that acts like Reflection in .Net, other wise I could convert a string into a Class. If anyone knows let me know please.
Enjoy!

Are you looking for something like this?
var spriteClass:Class = getDefinitionByName(“flash.display.Sprite”);
By the way, that’s in the flash.utils package.
Cool cheers Josh, man you must have the AS3 manual on your night stand ;o)
I have updated the classes , but I was interested to find a :: in the class path. Wow getting close to c++ lol
I got that by
var test:F2 = new F2();
var fKeyString:String = getQualifiedClassName(test);
// traces com.xsive.controls.menuClasses::F2
Grr looks like you have to have an instance of that object somewhere in the swf for it to work
( If you try this only the F2 will show.
private function iconFunctionKey(item:Object):Class{
if(XML(item).attribute(“functionKey”)){
var obj:F2 = new F2();
var str:String = getQualifiedClassName(obj);
//var fKeyClass:Class =
detDefinitionByName(“com.xsive.controls.menuClasses::F2″) as Class;
var fKeyClass:Class =
getDefinitionByName(“com.xsive.controls.menuClasses.” +
XML(item).attribute(“functionKey”).toString()) as Class;
//var ClassReference:Class =
getDefinitionByName(str) as Class;
//var instance:Object = new ClassReference();
return fKeyClass;
}else{
return null;
}
}
I got around the class requirement issue by sticking the class definitions in a RSL. So stick the F2 class in a RSL and link to it.
Yeah I have since found that you need an instance of the class in the movie to be able to generate one from reflection, and Im waiting for word back on this one. But I will try your RSL way now
)