I am working on a real estate transaction app, done in flex/cf. To
stream line things and to make it a little eaiser to get the data the
admins want, I am using a custom context menu on my data grids.
I have run into something I dont really conside a problem, but it is
something I would like to do. I have already created my context menu,
and it works just fine. Two things I would like to do is:
1. Remove the Settings menuitem and remove the About Adobe Flash
player 9 menu item. I have an inkling that the poeple using it might
confuse those with somehting else. Can this even be done?
2. I would also like to add small icons next to the menu items to give
it a nice look and feel. I have searched the live docs and cant seem
to find this. Any help with this would also be greatly appreciated.
Here is the code I am using.
import flash.ui.*;
import flash.events.*;
import mx.controls.dataGridClasses.*;
import mx.controls.Alert;
//-------------------------------------------------------------------------
//*****************HANDLE LISTING SEARCH CONTEXT
MENU**********************
// SET CONTEXT MENU VAR
private var listSearchM:ContextMenu;
private function applyContextMenu(){
createListingMenu();
listingSearchDG.contextMenu = listSearchM;
}
private function createListingMenu(){
listSearchM = new ContextMenu();
listSearchM.addEventListener("menuSelect",
menuSelectHandler);
listSearchM.hideBuiltInItems();
var customContextArray:Array = new Array();
var newList:ContextMenuItem = new
ContextMenuItem("Create New Listing");
newList.addEventListener("menuItemSelect",
newListHandler);
var conClose:ContextMenuItem = new
ContextMenuItem("Convert To Closing");
conClose.addEventListener("menuItemSelect",
conCloseHandler);
var conRental:ContextMenuItem = new
ContextMenuItem("Convert to Rental");
conRental.addEventListener("menuItemSelect",
conRentalHandler);
var canList:ContextMenuItem = new
ContextMenuItem("Cancel Listing");
canList.addEventListener("menuItemSelect",
canListHandler);
customContextArray.push(newList);
customContextArray.push(conClose);
customContextArray.push(conRental);
customContextArray.push(canList);
listSearchM.customItems = customContextArray;
}
private function
menuSelectHandler(event:ContextMenuEvent):void
{
var renderer:DataGridItemRenderer =
DataGridItemRenderer(event.mouseTarget);
trace("rowIndex: " + renderer.listData.rowIndex);
trace("columnIndex: " +
DataGridListData(renderer.listData).columnIndex);
}
// TEST HANDLERS
private function newListHandler(){
Alert.show("You have selected to create a new list")
}
private function conCloseHandler(){
Alert.show("You have selected to Convert to a Closing")
}
private function conRentalHandler(){
Alert.show("You have selected to Convert to a Rental")
}
private function canListHandler(){
Alert.show("You have selected to Cancel a listing")
}
--
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/