instead of making the tree row/column editable on single click i added a small pop-up on double click that allows the user to edit the name/delete the dir/add sub folders/or refresh. the events/listeners all work fine. I get two problems though: 1. if you choose to edit the name of one folder and then try to do something else with another folder (delete , for example) it will send out the event and the event will be caught but then the tree sets focus on the last column edited just like you were renaming it (starts the editor). I have trace's and breaks everywhere and it appears to be happening in the List or Tree main class ( i created a productTree class that extends the Tree class and overwrote the doubleClickHandler for it to no avail).
2. If I chose NOT to edit my first selection in the tree (instead delete, for example). all the events fire and are caught but the top-most folder gets the focus and its editor starts like its being renamed. I followed Alex's DataGrid double click editor on his website and that didnt help either (but much appreciated). here is the code, maybe someone can help. THANKS!! <?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" creationComplete="init()" xmlns:local="custom_as.*"> <mx:Script> <![CDATA[ import mx.controls.Alert; import managers.UserManager; import mx.events.ListEvent; import mx.controls.TextInput; import mx.managers.PopUpManager; import mx.core.IFlexDisplayObject; import popUps.EditTreeItems; import mx.core.Application; import managers.EditTreeItemsManager; import events.EditTreeItemsEvent; import mx.controls.Alert; import mx.events.CloseEvent; //local vars private var editItemsWindow:IFlexDisplayObject; private var newData:Object; //edit, delete, new sub folder, objects to call private var itemObj:Object; //the event item being clicked for editing private var rIndex:Number; private function init():void { UserManager.getInstance().addEventListener(EditTreeItemsEvent.PRODUCTEDIT,editItem); UserManager.getInstance().addEventListener(EditTreeItemsEvent.DELETE,deleteItem); UserManager.getInstance().addEventListener(EditTreeItemsEvent.NEWSUB,addNewSubFolder); UserManager.getInstance().addEventListener(EditTreeItemsEvent.REFRESH,refreshItem); //trace("listeners being added"); } //show the popup for editing private function showEditPopUp(event:ListEvent):void { event.preventDefault(); itemObj = tree.selectedItem; rIndex = event.rowIndex; trace(rIndex + "event.row index"); // Create a non-modal TitleWindow container. editItemsWindow = PopUpManager.createPopUp(this, EditTreeItems, false); editItemsWindow.alpha = 1.0; editItemsWindow.addEventListener(MouseEvent.ROLL_OUT,closePopUp); //close the popup when the mouse rolls off editItemsWindow.x = Application.application.mouseX ; editItemsWindow.y = Application.application.mouseY + 5; } //on mouse rollout close the popup private function closePopUp(e:MouseEvent= null):void { editItemsWindow.removeEventListener(MouseEvent.ROLL_OUT,closePopUp); PopUpManager.removePopUp(editItemsWindow); rIndex = 0; //reset the rIndex just in case itemObj = null; //reset the itemObj too } //called from the listener to edit the name of the folder being called private function editItem(event:Event ):void { trace(rIndex + "row index"); tree.editedItemPosition = {columnIndex:0,rowIndex:rIndex}; tree.addEventListener(ListEvent.ITEM_EDIT_END,editEnd); //once the edit is closed , call the editEnd function } //once the editing of the node is done this method is called which puts all the data in an object and sends it out the server private function editEnd(event:ListEvent):void { newData = new Object(); //object for sending for editing new name var dataObj:Object = event.itemRenderer.data; //the new name of the label to send back newData.action = "edit"; newData.id = [EMAIL PROTECTED]; //the id to replace the old name in the DB newData.oldName = [EMAIL PROTECTED]; //the old name newData.name = TextInput(event.currentTarget.itemEditorInstance).text; //the new name to change to //editProdReq.send(newData); //this is the HTTPRequest to rename the tree //trace("newData:" + newData.name + "Id:"+newData.id + "oldName" + newData.oldName); } private function deleteItem(e:Event):void { trace("delete started"); mx.controls.Alert.show("Are you sure you want to delete this directory and all of it content?","Delete Directory",3,this,alertClickHandler); //send out the delete to the PHP to delete the directory } private function alertClickHandler(event:CloseEvent):void { if (event.detail==Alert.YES) trace("send out delete") else return; } private function addNewSubFolder(e:Event):void { trace("adding sub folder"); } private function refreshItem(e:Event):void { trace("refreshing"); } //shows whats in the tree private function tree_labelFunc(item:Object):String { var suffix:String = ""; if (tree.dataDescriptor.isBranch(item)) { suffix = " (" + item.children().length() + ")"; } return [EMAIL PROTECTED] + suffix; } //disable the editing on single click and remake it double click private function disableEditing(event:ListEvent):void { event.preventDefault(); // tree_itemClick(event); } //edit the tree item on the double click of the item private function editTreeItem(e:ListEvent):void { trace("edit tree item entered"); } //load the text after the SWF has loaded with the SWF info. will remove later private function swfLoader_complete(evt:Event):void { panel.status = (swfLoader.bytesTotal/1024).toFixed(2) + 'KB'; } ]]> </mx:Script> <!-- DUMMY XML will eventually be a PHP script and HTTp request to reload after updating --> <mx:XML id="dp" source="../xml/dp.xml" /> <mx:HDividedBox width="100%" height="100%"> <mx:Panel width="200" height="100%"> <local:ProductTree doubleClickEnabled="true" itemDoubleClick="showEditPopUp(event)" editable="true" itemEditBeginning="disableEditing(event)" editorXOffset="0" editorYOffset="0" allowMultipleSelection="false" id="tree" dataProvider="{dp}" labelFunction="tree_labelFunc" showRoot="false" width="100%" height="100%" />