[flexcoders] Re: Context Menu Bug in FlashPlayer ? ~ Adobe Flex Training
Adobe Flex Training: [flexcoders] Re: Context Menu Bug in FlashPlayer ?

JMAC - JOB Market Access Center

[flexcoders] Re: Context Menu Bug in FlashPlayer ?

The code below causes both IE and Firefox to crash (haven't tried others). The problem seems to occure when removing an item from a custom context menu. It doesn't even debug, just crashes the browser.

If I add this one line:

menu.customItems. pop();

then the browser crashes. If I remove it, if functions as expected.

Please help.

Sample code below:




import mx.controls. Alert;
[Bindable] public var menu:ContextMenu;
[Bindable] public var blankMenu:ContextMe nu;

public function mouseOvr(event: MouseEvent) :void {
menu = new ContextMenu;
var addPop:ContextMenuI tem = new ContextMenuItem( "Do Something");
addPop.addEventList ener(ContextMenu Event.MENU_ ITEM_SELECT, newPop);
menu.customItems. push(addPop) ;
myButton.contextMen u = menu;
}
public function newPop (event:ContextMenuE vent):void {
Alert.show(" Hi");
}
public function mouseOt(event: MouseEvent) :void {
myButton.contextMen u = blankMenu;
menu.customItems. pop();
}
]]>


Related Posts by Categories

3 comments:

Anonymous said...

In flexcoders@yahoogro ups.com, "jmfillman" jmfillman@wrote:

Any suggestions? Am I doing something wrong?
JF

valdhor said...

In flexcoders@yahoogro ups.com, "valdhor" valdhorlists@ ... wrote:

I tried your code and it crashes my browser here. I could not find a way to stop that behavior in my (Admittedly short) testing.

The only thing that jumped out at me was that your blankMenu is a null object as it is never instantiated. Unfortunately, even if it is instantiated, the crashing continues.
>
> The one question I have is why you are assigning a blank menu on mouseout? There is no reason to do this. If the mouse is no longer over the button, there is no context menu. I would just ignore a mouseout entirely.

If I get some more time I will have another look. Other that that, maybe someone else has a suggestion.
Steve

jmfillman said...

Thank you for the follow-up. The blankMenu is actually a left over from my actual application and wasn't needed for this sample code.

This worked fine in FlashPlayer 9, so must be a bug with 10.

JF

Post a Comment