2 Replies Latest reply on Apr 14, 2010 6:05 PM by slim0001

    How do I add a contextMenu to a spark Panel...


      I've tried doing it the way that I used in Flex 3.5, but it doesn't seem to work in Spark. Is this a bug in spark?


      I've included code to demonstrate the problem, it has a Spark Panel and a Halo Panel, the Spark Panel doesn't have the correct ContextMenu, but the Halo Panel does.


      Any ideas what I'm doing wrong?


      ------------------------------------------------------------ SNIP ------------------------------------------------------------

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"



         minWidth="955" minHeight="600"  creationComplete="createComplete()" >


      <!-- Place non-visual elements (e.g., services, value objects) here -->





      private function createComplete() : void  {

      var contextMenu:ContextMenu = new ContextMenu();



      var customItems:Array = new Array;

      var item:ContextMenuItem;


      item = new ContextMenuItem("Item1", false, true, true);



      item = new ContextMenuItem("Item2", false, true, true);




      contextMenu.customItems = customItems;

      haloPanel.contextMenu = contextMenu;

      sparkPanel.contextMenu = contextMenu;





      <s:Panel id="sparkPanel" width="50%" height="100%" backgroundColor="0x00ff00"/>


      <mx:Panel id="haloPanel" x="{width/2}" width="50%" height="100%" backgroundColor="0x0000ff"/>


      ------------------------------------------------------------ SNIP ------------------------------------------------------------