I my case I need to put 2 icons and a label....

I believe the only way is the render.


VELO

On Wed, Dec 12, 2007 at 4:48 PM, Andriy Panas <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Hi Alex,
>
> Your suggestion had helped to solve this RTE issue with MenuBarRenderer that
> contains at least one mx:Label instance.
>
> But for this particular case of the renderer that contains only text
> information, I would encourage to use labelFunction instead together with
> MenuBar.
>
> Here is the link to the nice hands on example of using labelFunction
> together with Tree that gives the idea:
>
> http://blog.flexexamples.com/2007/10/29/defining-a-custom-label-function-on-a-flex-tree-control/
>
>
>
>
>
> On 10/12/2007, Alex Harui < [EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > Try setting mouseEnabled and/or mouseChildren=false on the label and other
> children.
> >
> > ________________________________
>  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Marvin Froeder
> > Sent: Wednesday, December 05, 2007 10:55 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Menubar Render
> >
> >
> >
> >
> >
> >
> > Hi folks,
> >
> > I had create a MenuBar (copy from LiveDoc's exemple) and set a custom
> menuBarItemRenderer.
> >
> > But when I tried to run I got a runtime error, every time I put the cursor
> over the render.
> >
> > Error:
> >
> > >
> > >
> > > TypeError: Error #1034: Type Coercion failed: cannot convert
> mx.core::[EMAIL PROTECTED] to
> mx.controls.menuClasses.IMenuBarItemRenderer.
> > >
> > >       at
> mx.controls::MenuBar/mouseOverHandler()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\MenuBar.as:1670]
> >
> >
> >
> > Menubar (MenuBarLiveDocsExample.mxml):
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <!-- Simple example to demonstrate the MenuBar control. -->
> > > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml";
> creationComplete="initCollections();" >
> > >
> > >     <mx:Script>
> > >         <![CDATA[
> > >
> > >             import mx.events.MenuEvent;
> > >             import mx.controls.Alert;
> > >             import mx.collections.*;
> > >
> > >             [Bindable]
> > >             public var menuBarCollection:XMLListCollection;
> > >
> > >             private var menubarXML:XMLList =
> > >                 <>
> > >                     <menuitem label="Menu1" data="top">
> > >                         <menuitem label="MenuItem 1-A" data="1A"/>
> > >                         <menuitem label="MenuItem 1-B" data="1B"/>
> > >                     </menuitem>
> > >                     <menuitem label="Menu2" data="top">
> > >                         <menuitem label="MenuItem 2-A" type="check"
> data="2A"/>
> > >                         <menuitem type="separator"/>
> > >                         <menuitem label="MenuItem 2-B" >
> > >                             <menuitem label="SubMenuItem 3-A"
> type="radio"
> > >                                 groupName="one" data="3A"/>
> > >                             <menuitem label="SubMenuItem 3-B"
> type="radio"
> > >                                 groupName="one" data="3B"/>
> > >                         </menuitem>
> > >                     </menuitem>
> > >                 </>;
> > >
> > >             // Event handler to initialize the MenuBar control.
> > >             private function initCollections():void {
> > >                 menuBarCollection = new XMLListCollection(menubarXML);
> > >             }
> > >
> > >             // Event handler for the MenuBar control's itemClick event.
> > >             private function menuHandler(event:MenuEvent):void  {
> > >                 // Don't open the Alert for a menu bar item that
> > >                 // opens a popup submenu.
> > >                 if ([EMAIL PROTECTED] != "top") {
> > >                     Alert.show("Label: " + [EMAIL PROTECTED] + "\n" +
> > >                         "Data: " + [EMAIL PROTECTED], "Clicked menu
> item");
> > >                 }
> > >             }
> > >          ]]>
> > >     </mx:Script>
> > >
> > >     <mx:Panel title="MenuBar Control Example" height="75%" width="75%"
> > >         paddingTop="10" paddingLeft="10">
> > >
> > >         <mx:Label width="100%" color="blue"
> > >            text="Select a menu item."/>
> > >
> > >         <mx:MenuBar labelField="@label" itemClick="menuHandler(event);"
> > >             dataProvider="{menuBarCollection}"
> menuBarItemRenderer="MyCustomRender"/>
> > >
> > >     </mx:Panel>
> > > </mx:Application>
> > >
> >
> >
> >
> >
> >
> > Item Render (MyCustomRender.mxml ) :
> > >
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";
> > >     implements="mx.controls.menuClasses.IMenuBarItemRenderer "
> > >     >
> > >
> > >     <mx:Script>
> > >         <![CDATA[
> > >
> > >             import mx.controls.MenuBar;
> > >
> > >             private var _menuBar:MenuBar;
> > >             private var _menuBarIndex:int;
> > >             private var _menuBarItemState:String;
> > >
> > >             public function get menuBar():MenuBar {
> > >                 return _menuBar;
> > >             }
> > >
> > >             public function set menuBar(value:MenuBar):void {
> > >                 _menuBar = value;
> > >             }
> > >
> > >             public function get menuBarItemIndex():int {
> > >                 return _menuBarIndex;
> > >             }
> > >
> > >             public function set menuBarItemIndex(value:int):void {
> > >                 _menuBarIndex = value;
> > >             }
> > >
> > >             public function get menuBarItemState():String {
> > >                 return _menuBarItemState;
> > >             }
> > >
> > >             public function set menuBarItemState(value:String):void {
> > >                 _menuBarItemState = value;
> > >             }
> > >
> > >         ]]>
> > >     </mx:Script>
> > >
> > >     <mx:Label text="[EMAIL PROTECTED]" />
> > >     <mx:Spacer width="100%" />
> > >     <mx:Image source="/anything.png" height="100%" width="30" />
> > >
> > > </mx:HBox>
> >
> >
> >
> >
> > Any one knows how to solve this?
> >
> >
> > VELO
> >
> >
> >
> >
> >
> >
> >
>
>
>
> --
> --
> Med venlig hilsen / Best regards
> Andriy Panas
> [EMAIL PROTECTED] 

Reply via email to