R – Flex: referencing all data in TileList

actionscript-3airapache-flexselectiontilelist

I have 2 TileList component in my Flex application.

1 tilelist is filled with data much like following xml sample:

<person name="Test">
<likes>Flex</likes>
<likes>PHP</likes>
</person>
<person name="test2">
<likes>HTML</likes>
<likes>CSS</likes>
</person>

the data shown in that tilelist is the name.

my second tilelist:

<items>
<preference>Flex</preference>
<preference>Flash</preference>
<preference>HTML</preference>
<preference>CSS</preference>
<preference>PHP</preference>
<preference>CMS</preference>
<preference>ASP</preference>
<preference>C</preference>
</items>

data shown is the preference.

The user can click the first tilelist and then the items that person "likes" should be selected in the second tilelist (in other words they lit up).

click event on my first tilelist

private function highlightPreferences(e:ListEvent):void{
trace(e.currentTarget);
//and now I'm stuck
}

Is there any way to achieve this?

Best Answer

Just write a function that returns the selectedIndices for a particular person. Then, bind the second TileList's selectedIndices like this: selectedIndices="{findLikes(firstList.selectedItem)}" The binding will fire if firstList.selectedItem changes.

Oh, and please don't use a repeater. Lists can do everything repeater can better.

Related Topic