Yeah, I ran into this one. I'm going to bet that you're setting the
dataprovider of the popupmenubutton with Object objects (as opposed to XML
or something else). There's a bug in the component. Try setting the type
property of the Object to an empty string.

So your code might look like this:

var obj:Object = new Object();
obj.type = "";
obj.label = "measure angle";
obj.icon = angleIcon;

That part that says obj.type = "" is the important part. Yeah, you shouldn't
have to do this, it's a problem with the MenuItemRenderer class. If you want
to dig in, take a look at the commitProperties of
mx.controls.menuClasses.MenuItemRenderer. I suppose this should get reported
as a bug, but it's saturday night for christ sake, time to go drinking.

Doug



On 3/10/07, Paul Hastings <[EMAIL PROTECTED]> wrote:

  i've got a popup button that loads a menu w/some icons & labels via
this function upon creation complete for that button:

private function initMeasurementMenu():void {
var measurementMenu:Menu = new Menu();
var dp:Object = [{label: "measure angle", icon:measureAngleIcon},
{label: "measure distance", icon:measureDistanceIcon}, {label:
"measure area", icon:calcAreaIcon}, {label: "erase measurement",
icon:eraseRedlineIcon}];
measurementMenu.dataProvider = dp;
measurementMenu.selectedIndex = 0;
measurementMenu.addEventListener("itemClick",
measurementItemClickHandler);
measurementPopUp.popUp = measurementMenu;
}

which works fine. my problem is that once a user clicks an item from
the menu & the menu is re-opened to use another item from the menu,
the previously selected icons are doubled & offset (screen capture
here: http://www.sustainablegis.com/projects/flex/popupmenu.htm).

any ideas?

thanks.

Reply via email to