Ok, I figured out, how to set a ContextMenu on a component. Works fine... with STATIC components like below .....
But with dynamic components???? If I change the initThis function below to this.... function initThis(){ //var my_cm = new _global["ContextMenu"](); var my_cm :ContextMenu = new ContextMenu(); my_cm.hideBuiltInItems(); my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler)); var test = canTest.createChild( mx.containers.Canvas,"canTestChild", { width : 50 , height : 50 , backgroundColor : "#ee0000"}); var contextOver = String( test.id ); mx.core.Application.application[ contextOver ].menu = my_cm; } ...it does not work anymore... HELP!! <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" initialize="initThis()"> <mx:Canvas id="canTest" width="50" height="50" backgroundColor="#ffffff" /> <mx:Script> <![CDATA[ var showItem = true; var my_cm:ContextMenu; function initThis(){ var my_cm = new _global["ContextMenu"](); //var my_cm :ContextMenu = new ContextMenu(); my_cm.hideBuiltInItems(); my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler)); var contextOver = String( canTest.id ); mx.core.Application.application[ contextOver ].menu = my_cm; mx.controls.Alert.show(mx.core.Application.application[ contextOver ]); //canTest.menu = my_cm; } function menuHandler(obj, menuObj) { if (showItem == false) { menuObj.customItems[0].enabled = false; } else { menuObj.customItems[0].enabled = true; } } function itemHandler(obj, item) { //...put code here... mx.controls.Alert.show("selected!"); } ]]> </mx:Script> </mx:Application> > -----Ursprüngliche Nachricht----- > Von: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Im > Auftrag von Christoph Diefenthal > Gesendet: Donnerstag, 29. September 2005 17:05 > An: 'flexcoders@yahoogroups.com' > Betreff: [flexcoders] mouse-right-click-event? > > Hi people, > > Is there a possibility to process a mouse-right-click-event instead of > opening the flash-menu? > > Cheers > Christoph > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/