0 Replies Latest reply on Apr 15, 2007 10:08 AM by GlopZ

    VideoDisplay and ContextMenu

    GlopZ
      I wish to add a contextmenu item on a videodisplay component. When a video is playing and the menuitem selected, the contextmenuevent is not thrown. The following code is used :

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="creationComplete()">

      <mx:Script>
      <![CDATA[
      import mx.core.UIComponent;
      import mx.controls.Alert;

      private function eventHandler(event:ContextMenuEvent) : void
      {
      mx.controls.Alert.show("event called");
      }

      private function creationComplete() : void
      {
      var contextMenu:ContextMenu = new ContextMenu;
      contextMenu.hideBuiltInItems();

      var menuItem:ContextMenuItem = new ContextMenuItem("test");
      menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, eventHandler);

      contextMenu.customItems.push(menuItem);

      video.contextMenu = contextMenu;
      }
      ]]>
      </mx:Script>

      <mx:VideoDisplay id="video" source="myVideo.flv" width="300" height="300"/>

      </mx:Application>

      Can someone help me to solve the problem ?

      Thanks