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();
}
]]>
3 comments:
In flexcoders@yahoogro ups.com, "jmfillman" jmfillman@wrote:
Any suggestions? Am I doing something wrong?
JF
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
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