Multiple ContextMenuItem for different objects
OK here is a simple way to create as many objects as you want context menus:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; function addContext(sprite_:Sprite):void { var menu:ContextMenu = new ContextMenu(); menu.customItems = [new ContextMenuItem("Select only " + sprite_.name)]; menu.hideBuiltInItems(); sprite_.contextMenu = menu; } addContext(yellow); addContext(green); addContext(red); addContext(blue); addContext(this); |
note that yellow, green, red, blue are Sprites, but it can be also buttons
Example:
This movie requires Flash Player 10
Nice post about The Right-Click Menu in Flash by Raiyan

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution 2.5 Bulgaria License.
You can skip to the end and leave a response. Pinging is currently not allowed.
