The other thing that is odd is, if you look at the code you will se a line that looks like this:
myMenu.labelField="@label"
I dont know why I need the @ here at all. But without it the label doesnt show up whereas with it it does. But for the following line
myMenu.labelField="@icon"
The icons dont show up.
I know that I am embedding the icon properly because the code also embeds one of the same icons inside the button.
Any help appreciated.
Hank
<?xml version=" 1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:LinkButton id="linkButton" width="100"
icon="@Embed(source='../assets/assets.swf', symbol='thumbsup')"
click="showMenu();">
<mx:Script>
<![CDATA[
import mx.controls.Menu;
import mx.events.MenuEvent;
import mx.controls.Alert;
import flash.geom.Point;
[Embed(source='../assets/assets.swf', symbol='thumbsup')]
public var thumbsup:Class;
[Embed(source='../assets/assets.swf', symbol='thumbsdown')]
public var thumbsdown:Class;
private var point1:Point = new Point();
private var myMenu:Menu;
// Create and display the Menu control.
private function showMenu():void {
myMenu= Menu.createMenu(parent, myMenuData, false);
myMenu.labelField="@label"
myMenu.iconField="@icon"
myMenu.addEventListener("itemClick", menuHandler);
// Calculate position of Menu in Application's coordinates.
point1.x=linkButton.x;
point1.y=linkButton.y;
point1= linkButton.localToGlobal(point1);
myMenu.show(point1.x, point1.y + linkButton.height + 1);
}
// Event handler for the Menu control's change event.
private function menuHandler(event:MenuEvent):void {
Alert.show("Label: " + event.item.label, "Clicked menu item");
}
]]>
</mx:Script>
</mx:LinkButton>
<mx:XML id="myMenuData">
<root>
<menuitem label="No vote"/>
<menuitem icon="thumbsup"/>
<menuitem icon="thumbsdown"/>
</root>
</mx:XML>
</mx:Canvas>
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.