> My understanding was that the XMLListCollection methods would handle the needed events, but apparently not.

Well, it should, and maybe this just isn't completly worked out yet in the Tree class. When you do anything to a collection be it XML or Objects, it will produce a COLLECTION_CHANGE event that has the CollectionEventKind type that you then use to figure out what happened.

I know the Tree is pipped into this when the dataProvider is set. Must be a bug or something that is not completly wired.

Peace, Mike

On 5/24/06, Bryan Choi <[EMAIL PROTECTED]> wrote:
Thanks Tracy,
 
it looks well.
 
I'll apply your way to my application.
 
Thank you for your help.
 
Regards,
Bryan Choi. 
----- Original Message -----
Sent: Thursday, May 25, 2006 12:00 PM
Subject: RE: [flexcoders] Fw: [BETA3] I found how can remove the selected item of mx.controls.Tree.

Bryan , I found another way to do this, using XMLListCollection.  Strangely, I still have to call invalidateList to get the tree to refresh.  My understanding was that the XMLListCollection methods would handle the needed events, but apparently not.

 

Tracy

 

            //deletes the currently selected node

            private function deleteSelectedNode():void

            {

                        var nodeToDelete:XML = XML(treeData.selectedItem);    //reference to the node to delete

                        var xlcParent:XMLListCollection = new XMLListCollection(nodeToDelete.parent().children()); //collection of nodes containing the node to delete

                        var iIndex:int = xlcParent.getItemIndex(nodeToDelete);    //index of node to delete in collection

                        xlcParent.removeItemAt(iIndex);    //remove the node

                        treeData.invalidateList();    //refresh the tree

            }//deleteSelectedNode

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Bryan Choi
Sent: Wednesday, May 24, 2006 4:22 AM
To: flexcoders
Subject: [flexcoders] Fw: [BETA3] I found how can remove the selected item of mx.controls.Tree.

 

 

----- Original Message -----

From: Bryan Choi

Sent: Tuesday, May 23, 2006 9:33 PM

Subject: [BETA3] I found how can remove the selected item of mx.controls.Tree.

 

Hi, all.

 

var treeItem :Object = mxTree.selectedItem;
  var parentItem :Object = mxTree.getParentItem ( treeItem );
  var items :ICollectionView = treeDD.getChildren (parentItem);
  var len :int = items.length;
  for ( var i:int=0; i<len; i++ )
  {
   if ( items [EMAIL PROTECTED] == [EMAIL PROTECTED] )
   {
    treeDD.removeChildAt ( parentItem, mxTree.selectedItem, i );
    break;
   }
   }

 

===========================

 

It is lengthy. so..

 

I want  Anyone who has idea other to know simple code rather than above.

 

Thank you,

Brayn.




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
What goes up, does come down.

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to