What about this:
searchDP(FontFamily.dataProvider, "label", style.fontFamily);
public function searchDP(arrToSearch:ArrayCollection, field:String, value:String):Number
{
for (var idx = 0; idx < arrToSearch.length; ++idx)
{
if (arrToSearch.getItemAt(idx)[field] == value) {return idx};
}
return -1;
}
--- In [email protected], "vestcomprogrammer" <[EMAIL PROTECTED]> wrote:
>
>
> It works in flex 1.5 but I try to run the same code in Flex 2.0 Beta 2
> and it gives me one element in the array.
>
>
>
>
>
> XML FILE
> <?xml version="1.0" encoding="utf-8"?>
> <Fonts>
> <font label="-- not selected --" data="" />
> <font label="Arial" data="" />
> <font label="Georgia" data="" />
> <font label="Impact" data="" />
> <font label="Tahoma" data="" />
> <font label="Times New Roman" data="" />
> <font label="Verdana" data="" />
> <font label="Webdings" data="" />
> <font label="Windings" data="" />
> </Fonts>
>
>
> My Code
>
> <mx:Model id="fontModel" source="data/filteredFontList.xml"/>
>
> //Call to the funciton
> searchDP(mx.utils.ArrayUtil.toArray(FontFamily.dataProvider), "label",
> style.fontFamily);
>
>
> public function searchDP(arrToSearch:Array, field:String,
> value:String):Number
> {
> for (var idx = 0; idx < arrToSearch.length; ++idx)
> {
> if (arrToSearch[idx][field] == value) {return idx};
> }
> return -1;
> }
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| 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.

