Here is the working version :)
Regards,
Arul
<?xml version="1.0" encoding="utf-8"?>
<
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"><mx:Script><![CDATA[
mx.collections.XMLListCollection;
mx.collections.ArrayCollection;
[Bindable] public var myData:XML =
<catalog>
<category name="Companies" />
</catalog>;
function buildTree():void{
/*
you have created tags with the name "name" instead
creating attribute
*/
//myData.category.name[0]="Nat West PLC";
//myData.category.name[0].name[0]="Nat West Reading";
[EMAIL PROTECTED]"Nat West PLC";
[EMAIL PROTECTED]"Nat West Reading";}
]]></mx:Script>
<mx:Panel>
<mx:Tree id="prodTree" dataProvider="{myData}" width="200" showRoot="false" labelField="@name" enabled="true" borderStyle="inset"/>
<mx:Button click="buildTree()" label="Build"/>
</mx:Panel>
</mx:Application>
----- Original Message -----
From: "jamiebadman" <[EMAIL PROTECTED]>
Sent: Tuesday, August 22, 2006 6:35 PM
Subject: [flexcoders] Populating a tree with E4X
notation
>
> Wonder if someone can help... I'm trying to build a basic tree using
> E4X notation but it's going kinda weird - as you can see if you run
> the code below, the tree seems to show ok - but it also shows the
> XML over the top of the tree!
>
> I guess I'm doing something quite wrong here - could someone put me
> on the right track ?
>
> (code below)
>
> Thanks,
>
> Jamie.
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application
> xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
>>
>
> <mx:Script>
> <![CDATA[
> import mx.collections.XMLListCollection;
> import mx.collections.ArrayCollection;
>
> [Bindable] public var myData:XML =
> <catalog>
>
> <category name="Companies" />
> </catalog>;
>
> private function buildTree():void{
>
> myData.category.name[0]="Nat West PLC";
> myData.category.name[0].name[0]="Nat West
> Reading";
> }
> ]]>
> </mx:Script>
>
> <mx:Panel>
> <mx:Tree id="prodTree" dataProvider="{myData}"
> width="200" showRoot="false" labelField="@name" enabled="true"
> borderStyle="inset"/>
> <mx:Button click="buildTree()" label="Build"/>
>
> </mx:Panel>
> </mx:Application>
__._,_.___
--
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
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
treeTest.mxml
Description: Binary data