Rick's code isn't working for you? That's weird. I double checked my code,
and I'm adding the context menu to the textField's parent component.  So I'm
not sure what's going on here.
What framework/player versions are you using?

- Daniel Freiman

On Mon, Jun 30, 2008 at 12:07 PM, sbx33 <[EMAIL PROTECTED]> wrote:

>   Well, I'm not sure what I'm doing wrong, but when I put this code in
> exactly, and right click in the text area, all I see in the context
> menu are "Cut", "Copy", "Paste", and "Select All". The only way to see
> a context menu with "BAR!" in it, is to click the very edge of the
> text area. This really isn't what I'm looking for. I really need to
> add menu items to the Cut-Copy-Paste-Select All menu.
>
> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Rick
> Winscot" <[EMAIL PROTECTED]>
> wrote:
>
> >
> > The mechanism for adding a custom context menu item to a standard
> context
> > menu is the same as adding it to a text sensitive context menu.
> >
> > 1. Create a context menu
> > 2. Create a context menu item
> > 3. Add the custom menu item to the context menu
> > 4. Associate the context menu with the control (in this case the text
> > whatnot control)
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > creationComplete="init();" layout="absolute">
> >
> > <mx:Script>
> > <![CDATA[
> >
> > public function init():void
> > {
> > var ctx:ContextMenu = new ContextMenu();
> > var mit:ContextMenuItem = new ContextMenuItem( "BAR!" );
> > ctx.customItems.push( mit );
> > foo.contextMenu = ctx;
> > }
> >
> > ]]>
> > </mx:Script>
> > <mx:TextArea id="foo" x="401" y="249"/>
> > </mx:Application>
> >
> >
> > Right click in the text area and - Voila! Foo bar baby!
> >
> >
> > Rick Winscot
> >
> >
> >
> > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> [mailto:
> flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On
> > Behalf Of sbx33
> > Sent: Thursday, June 26, 2008 7:44 PM
> > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Re: Right click context menus
> >
> > Unfortunately, I'm not sure what to even try. If anyone else has any
> > ideas, please let me know. Thanks!
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> "Daniel Freiman" <FreimanCQ@> wrote:
> > >
> > > I can't find where in my code I am doing it, but I am. I don't
> remember
> > > caring about the distinction between the two types of context
> menus. So
> > > just try it and it will probably work.
> > >
> > > - Daniel Freiman
> > >
> > > On Tue, Jun 24, 2008 at 12:46 PM, sbx33 <sbx33@> wrote:
> > >
> > > > Hello!
> > > >
> > > > Per the Flex documentation:
> > > >
> > > > "Flash Player has three types of context menus: the standard menu
> > > > (which appears when you right-click in Flash Player), the edit menu
> > > > (which appears when you right-click a selectable or editable text
> > > > field), and an error menu (which appears when a SWF file has
> failed to
> > > > load into Flash Player). Only the standard and edit menus can be
> > > > modified with the ContextMenu class."
> > > >
> > > > I have been able to add custom menu items to the "standard menu"
> > > > however, I'm wondering if anyone knows how to add custom menu
> items to
> > > > the "edit menu" on a flex component, such as a TextArea.
> > > >
> > > > The code I am using to add items to the "standard menu" is:
> > > >
> > > > var newCM:ContextMenu = new ContextMenu();
> > > > var newCMI:ContextMenuItem = new ContextMenuItem("New Item");
> > > > newCM.customItems.push(newCMI);
> > > >
> > > > TIA!
> > > >
> > > > -Mac
> > > >
> > > >
> > > >
> > >
> >
>
>  
>

Reply via email to