here a quick example
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function disableEditing(event:ListEvent):void
{
event.preventDefault();
return;
}
private function onTeeDoubleClick(event:ListEvent):void
{
var rIndex:Number = event.rowIndex;
myTree.editedItemPosition = {columnIndex:0,
rowIndex:rIndex};
}
]]>
</mx:Script>
<mx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
<node label="Marketing"/>
<node label="Product Management"/>
<node label="Personal"/>
</node>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
</node>
<node label="Spam"/>
<node label="Sent"/>
</node>
</mx:XMLList>
<mx:Tree id="myTree" width="200" height="400"
dataProvider="{treeData}" labelField="@label"
doubleClickEnabled="true"
itemDoubleClick="onTeeDoubleClick(event)"
editable="true" itemEditBeginning="disableEditing(event)"
editorXOffset="0" editorYOffset="0"/>
</mx:Application>
--- In [email protected], "Morten Madsen" <[EMAIL PROTECTED]>
wrote:
>
> I am new to Flex, does anybody have a example of code?
>
> Wouldn't it be posible to use itemDoubleClick?
>
> Kind Regards
> Morten Madsen
>
>
>
> On 5/24/07, ivo [EMAIL PROTECTED] wrote:
> >
> > You have to set your Tree to editable and then listen for the
event
> > ListEvent.ITEM_EDIT_BEGIN .
> >
> > Your handler for this event can keep tabs for what was the last node
that
> > was clicked and at what time. If there were no previous clicks on
the target
> > node or the last click was more than x milliseconds ago then you
call
> > event.preventDefault(); to disable editing, otherwise there were two
> > consecutive clicks within x milliseconds so you let it continue and
the
> > label editing will take place.
> >
> >
> >
> > ----- Original Message ----
> > From: Morten Madsen [EMAIL PROTECTED]
> > To: [email protected]
> > Sent: Thursday, May 24, 2007 3:15:16 AM
> > Subject: [flexcoders] Tree edit item doubleclick
> >
> > Hi people!
> >
> > I have a tree, and I want to be able to double click on an item in
the
> > tree and then edit the name/label, is this posible?
> >
> > Kind regards
> > Morten Madsen
> >
> >
> >
>