Link to home
Start Free TrialLog in
Avatar of debugged
debuggedFlag for United States of America

asked on

How to make the text of Menubar and menubar items glow on mouse hover in Adobe Flex

I would like to make the text of Menubar and each of the menubar items glow on mouse hover in Adobe Flex

Thank for your help
<mx:MenuBar width="125" id="mainMenu" labelField="@label" cornerRadius="5">
			<mx:XMLList>
				<menuitem label="Search">
					<menuitem label="Address"/>
					<menuitem label="Intersection"/>
				</menuitem>
			</mx:XMLList>
		</mx:MenuBar>

Open in new window

Avatar of vindys80
vindys80
Flag of India image

Hi,

I don't see a direct meothod to add effect to menubaritem. So was using transform for glow effect.
Got idea from this blog
http://sherifabdou.com/2008/05/make-an-image-glow-when-there-is-a-roll-over-using-the-colortransform-class/

Thanks,
Vindys
<mx:Script>
		<![CDATA[
			import mx.events.MenuEvent;
			import mx.controls.menuClasses.MenuBarItem;
			/**
             * Create The Functions and the colortransform
             */
             private var myColorTransform:ColorTransform;
             
             /**
             * Create the mouseOut
             */
             private function MOut(event:MenuEvent):void
             {
                 //what we want to do is reset everything back and the
                 //easiest way to do that is just to create a blank
                 //colorTransform and set it to the image
                 myColorTransform = new ColorTransform();
                 //we leave the default values which should return
                 //the image back to the original
                 MenuBarItem(MenuBar(event.currentTarget).menuBarItems[event.index]).transform.colorTransform = myColorTransform;
             }
			private function mOver(event:MenuEvent):void{
				//on the mouseOver we want it to glow,
                 //you can play around with the offset and see which one you
                 //like the best
                 myColorTransform = new ColorTransform(1,1,1,1,54,54,54);
                 //now we set the colorTransform that we created to the 
                 //image

				MenuBarItem(MenuBar(event.currentTarget).menuBarItems[event.index]).transform.colorTransform = myColorTransform;
			}
		]]>
	</mx:Script>
    <mx:MenuBar id="myMenuBar" labelField="@label" itemRollOver="mOver(event)" itemRollOut="MOut(event)">

        <mx:XMLList>
            <menuitem label="MenuItem A">
                <menuitem label="SubMenuItem A-1" enabled="false"/>
                <menuitem label="SubMenuItem A-2"/>
            </menuitem>
            <menuitem label="MenuItem B"/>
            <menuitem label="MenuItem C"/>
            <menuitem label="MenuItem D">
                <menuitem label="SubMenuItem D-1" 
                    type="radio" groupName="one"/>
                <menuitem label="SubMenuItem D-2" 
                    type="radio" groupName="one"
                    selected="true"/>
                <menuitem label="SubMenuItem D-3" 
                    type="radio" groupName="one"/>
            </menuitem>
        </mx:XMLList>
    </mx:MenuBar>

Open in new window

Avatar of debugged

ASKER

Thanks for your reply. But your solution makes the menubar item glow. I am looking to make the text (label of the menuitem) glow. You are right that there are no direct methods.
I think one way would be to make an image with the text glowing and embed it in the application and make that appear on mouse rollover.
Hi,

I think you are right... No other workaround is coming to my mind.

Thanks,
Vindys
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial