Mxml
<?XML version= "1.0" encoding= "Utf-8"?><!--function Description: Use array as Dataprovider -<s:applicationXmlns:fx= "http://ns.adobe.com/mxml/2009"xmlns:s= "Library://ns.adobe.com/flex/spark"xmlns:mx= "Library://ns.adobe.com/flex/mx"MinWidth= "955"MinHeight= "All"> <Fx:script> <! [Cdata[protected function Tree_labelfunction (item:object): String {var num:string = "" ; if (Tree.dataDescriptor.hasChildren (item)) {num = "(" + Item.children.length + ")"; } return Item.label + num; } ]]> </Fx:script> <fx:declarations> <!--Place non-visual elements (such as services, value objects) here - <Fx:arrayID= "Data"> <Fx:objectlabel= "Stephen Chow Chi"> <Fx:children> <Fx:objectlabel= "1988"> <Fx:children> <Fx:objectlabel= "Thunderbolt Pioneer" Hong Kong box office 8916612 " /> <Fx:objectlabel= "Catch the Wind Man" Hong Kong box office 3149395 " /> <Fx:objectlabel= "best son-in-law" Hong Kong box office 5807710 /> </Fx:children> </Fx:object> <Fx:objectlabel= "1989"> <Fx:children> <Fx:objectlabel= "Dragon in Tianya" Hong Kong box office 6809853 /> <Fx:objectlabel= "The 7913329 of the Brave" Hong Kong box office /> <Fx:objectlabel= "Rogue Poor woman" Hong Kong box office 5624622 " /> <Fx:objectlabel= "The Wind and rain is the same" Hong Kong box office 9335299 /> </Fx:children> </Fx:object> </Fx:children> </Fx:object> <Fx:objectlabel= "Jet Li"> <Fx:children> <Fx:objectlabel= "1992"> <Fx:children> <Fx:objectlabel= "The Oriental Invincible (1992) of the Lake of laughter" /> <Fx:objectlabel= "Huang Fei Hong's two men as self-Improvement (1992)" /> <Fx:objectlabel= "Wong Fei Hong's Three Lions King (1992)" /> </Fx:children> </Fx:object> <Fx:objectlabel= "1993"> <Fx:children> <Fx:objectlabel= "Fangshiyu Ⅱ (1993)" /> <Fx:objectlabel= "The Demon-1993 of the Dragon Slayer" /> <Fx:objectlabel= "Yellow Fei Hong's Iron Chicken Bucket Centipede (1993)" /> <Fx:objectlabel= "Taiji Zhang Sanfeng (1993)" /> </Fx:children> </Fx:object> <Fx:objectlabel= "1993"> <Fx:children> <Fx:objectlabel= "New Shaolin Five Zu (1994)" /> <Fx:objectlabel= "Hero (1994)" /> <Fx:objectlabel= "Zhongnanhai Bodyguard (1994)" /> <Fx:objectlabel= "Letter to Papa" (1995) /> </Fx:children> </Fx:object> </Fx:children> </Fx:object> </Fx:array> </fx:declarations> <Mx:treeID= "Tree"Dataprovider= "{Data}"LabelField= "Label"width= " the"labelfunction= "Tree_labelfunction"/></s:application>
[Flex] Component Tree Series--the array as Dataprovider