Hi all,

There seems to be a problem with selecting tree nodes created by XML
comment elements in an XMLListCollection. The actual selection is made
but the visual cue or highlight is not set.. See example below. Why is
this happening? What would be the cleanest workaround?

Cheers,

Nick


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
initialize="onInitialize()">

     <mx:Script>
         <![CDATA[

             import mx.collections.XMLListCollection;

             [Bindable]
             private var companyData:XMLListCollection;

             private function onInitialize():void
             {
                 XML.ignoreComments = false;
                 var company:XML = <list><dept
title="Finance"><!--Comment--><employee name="John H"/><employee
name="Sam K"/></dept></list>;
                 companyData = new XMLListCollection(company.dept)
             }

             private function treeLabel(item:Object):String
             {
                 var node:XML = XML(item);
                 if (node.nodeKind() == "comment")
                 {
                     return node.toString();
                 }
                 if( node.localName() == "dept")
                 {
                     return [EMAIL PROTECTED];
                 }
                 else
                 {
                     return [EMAIL PROTECTED];
                 }
             }

         ]]>
     </mx:Script>

     <mx:Tree id="tree" dataProvider="{companyData}"
labelFunction="treeLabel" height="200" width="200"/>

</mx:Application>

Reply via email to