Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-19-2012, 10:22 AM   #1
bitbitbit
Member
 
Join Date: Aug 2008
Posts: 59
Default Context menu on panel?

Hi,
I am working with panels (mx.containers.Panel).
I have created a grid with draggable panels, the DragPanel class I use extends the Panel class. I am trying to make it so that when I right-click on the titlebar of the panels, a context-menu with a edit-button shows up.
If I click edit I need to know on which panel I rightclicked. Is it somehow possible to open a context menu which can keep information like on which panel I rightclicked? Maybe catch an event and see where the event came from?

Last edited by bitbitbit; 04-19-2012 at 10:35 AM. Reason: bad spelling
bitbitbit is offline   Reply With Quote
Old 04-19-2012, 02:17 PM   #2
bitbitbit
Member
 
Join Date: Aug 2008
Posts: 59
Default

Anyone?

I now have a custom right-click menu but still no idea how to find out where the click came from.
Perhaps I can look at the coordinates of the mouse during the right-click, and disable/enable my edit button according to this. But to do this I would need to be able to keep the coordinates of the right-click so I could find out which panel is being clicked.
I also should disable the menu-item when the wrong coordinates are clicked.

Does anyone have any idea how this is done?
bitbitbit is offline   Reply With Quote
Old 04-19-2012, 02:40 PM   #3
Xegnma
Member
 
Join Date: Sep 2007
Posts: 84
Default

Once you set up a custom ContextMenu on a DisplayObject you can add custom ContextMenuItem instances to your ContextMenu instance. ContextMenuItem instances generate "menuItemSelect" events that you can listen for.

Check out the online ActionScript Language Reference for how to use the ContextMenu and ContectMenuItem classes:

ContextMenu

ContextMenuItem

PS: Make a habit of using the online ActionScript Language Reference. You'll find a lot of your questions answered there once you do a little digging.
Xegnma is offline   Reply With Quote
Old 04-19-2012, 02:53 PM   #4
bitbitbit
Member
 
Join Date: Aug 2008
Posts: 59
Default

thanks for the reply.
I'll look into it.
I was searching for a right-click event so I could look at the coordinates and keep them in some variables. You stopped me just in time.
bitbitbit is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:42 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.