Pastebin launched a little side project called HostCabi.net, check it out ;-)Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 26th, 2011  |  syntax: MXML  |  size: 1.02 KB  |  hits: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
  3.  applicationComplete="{onApplicationComplete()}" xmlns:local="*">
  4.  
  5.   <mx:Script>
  6.    <![CDATA[
  7.      import mx.collections.ArrayCollection;
  8.      import mx.core.UIComponent;
  9.      import mx.controls.Button;
  10.      
  11.      [Bindable]
  12.      private var names:ArrayCollection = new ArrayCollection();
  13.      
  14.      private function onApplicationComplete():void {
  15.      
  16.        names.addItem({name: "Foo"});
  17.        
  18.        var cm:ContextMenu = new ContextMenu();
  19.        var cmi:ContextMenuItem = new ContextMenuItem('Foo bar');
  20.        cm.hideBuiltInItems();
  21.        cm.customItems = [cmi];
  22.    
  23.        grid.contextMenu = cm;
  24.        
  25.      }
  26.    ]]>
  27.  </mx:Script>
  28.  
  29.   <mx:VBox>
  30.     <mx:DataGrid dataProvider="{names}" id="grid">
  31.       <mx:columns>
  32.         <mx:DataGridColumn headerText="Name" dataField="name"/>
  33.       </mx:columns>
  34.     </mx:DataGrid>
  35.   </mx:VBox>
  36.      
  37. </mx:Application>