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

--- In [email protected], "valdhor" <valdhorli...@...> 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
> 
> 
> --- In [email protected], "jmfillman" <jmfillman@> wrote:
> >
> > Any suggestions? Am I doing something wrong?
> > 
> > JF
> > --- In [email protected], "jmfillman" <jmfillman@> wrote:
> > >
> > > 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:
> > > 
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
> > > layout="absolute">
> > >   <mx:Script>
> > >           <![CDATA[
> > >                   import mx.controls.Alert;
> > >                   [Bindable] public var menu:ContextMenu;
> > >                   [Bindable] public var blankMenu:ContextMenu;
> > >                   
> > >                   public function mouseOvr(event:MouseEvent):void {
> > >                           menu = new ContextMenu;
> > >                           var addPop:ContextMenuItem = new 
> > > ContextMenuItem("Do Something");
> > >                           
> > > addPop.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, newPop);
> > >                           menu.customItems.push(addPop);
> > >                           myButton.contextMenu = menu;
> > >                   }
> > >                   public function newPop (event:ContextMenuEvent):void {
> > >                           Alert.show("Hi");
> > >                   }
> > >                   public function mouseOt(event:MouseEvent):void {
> > >                           myButton.contextMenu = blankMenu;
> > >                           menu.customItems.pop();
> > >                   }
> > >           ]]>
> > >   </mx:Script>    
> > >   <mx:Button x="349" y="189" label="Button" width="101" height="41" 
> > > id="myButton" mouseOver="mouseOvr(event)" mouseOut="mouseOt(event)"/>
> > > </mx:Application>
> > >
> >
>


Reply via email to