Thank you, but now I get the runtime error:
TypeError: Error #1034: Type Coercion failed: cannot convert
rende...@4c310a1 to mx.controls.menuClasses.IMenuItemRenderer.
at
mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::deleteDependentSubMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2275]
at
mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::hideAllMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2289]
at
mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1706]
when I click at one entry.
My Renderer.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Text text="{data.label}" fontSize="16" fontWeight="bold"/>
</mx:VBox>
My Test.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationPolicy="all">
<mx:Style>
@font-face {
src:url("C:\\WINDOWS\\Fonts\\times.ttf");
fontFamily: myFont;
/* card suits */
unicodeRange: U+2660-U+266B;
}
Menu {
fontFamily: myFont;
fontSize: 24;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.*;
private function createMenu():void {
var bids:Array = [{label: "Pass"}];
for (var i:uint = 7; i <= 10; i++)
for (var j:uint = 0; j < 4; j++)
bids.unshift({label:
i+"♠♣♦♥".charAt(j%4)});
var menu:Menu = new Menu();
menu.dataProvider = bids;
menu.itemRenderer = new ClassFactory(Renderer);
menu.selectedIndex = 0;
pub.popUp = menu;
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="100%">
</mx:Canvas>
<mx:ApplicationControlBar width="100%">
<mx:Spacer width="100%"/>
<mx:PopUpButton id="pub" creationComplete="createMenu();"/>
</mx:ApplicationControlBar>
</mx:Application>
Does it mean VBox is missing some method needed by
IMenuItemRenderer? I'm just trying to get red + black entries
Regards
Alex