Posts Tagged ‘Style Array’

Style Array in MXML syntax and apply those values inline

February 2nd, 2011 by aabhaanjan

We can set the values of the Array in MXML syntax and apply those values inline.

Example :

[xml]

<?xml version=”1.0″?>

<s:Application

xmlns:fx=”http://ns.adobe.com/mxml/2009″

xmlns:mx=”library://ns.adobe.com/flex/mx”

xmlns:s=”library://ns.adobe.com/flex/spark”>

<fx:Declarations>

<fx:Array id=”myDepthColors”>

<fx:Object>0xFFCC33</fx:Object>

<fx:Object>0xFFCC99</fx:Object>

<fx:Object>0xCC9900</fx:Object>

</fx:Array>

<fx:Array id=”myAlternatingRowColors”>

<fx:Object>red</fx:Object>

<fx:Object>green</fx:Object>

</fx:Array>

<fx:XMLList id=”treeData”>

<node label=”Node 1″>

<node label=”Subnode 1″>

<node label=”label 1″/>

<node label=”label 2″/>

</node>

<node label=”Subnode 2″>

<node label=”label 1″/>

<node label=”label 2″/>

</node>

</node>

</fx:XMLList>

</fx:Declarations>

<s:Panel title=”Test” width=”50%”>

<mx:Tree id=”tree”

width=”100%”

labelField=”@label”

dataProvider=”{treeData}”

depthColors=”{myDepthColors}”

alternatingItemColors=”{myAlternatingRowColors}”/>

</s:Panel>

</s:Application>

[/xml]

Tags: , ,