Flex4 spark list which shows the number

Displaying the row number or index in a spark List
http://flexponential.com/2010/02/08/displaying-the-row-number-or-index-in-a-spark-list/
Flex4 spark list which shows the number

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark" width="200" height="215"  viewSourceURL="srcview/index.html">

    <s:List height="200" width="200" top="10">
        <s:layout>
            <s:VerticalLayout gap="1" horizontalAlign="justify" />
        </s:layout>
        <s:dataProvider>
            <s:ArrayList>
                <fx:String>Roberto Luongo</fx:String>
                <fx:String>Scott Niedermayer</fx:String>
                <fx:String>Jarome Iginla</fx:String>
                <fx:String>Dan Boyle</fx:String>
                <fx:String>Rick Nash</fx:String>
                <fx:String>Ryan Getzlaf</fx:String>
                <fx:String>Martin Brodeur</fx:String>
                <fx:String>Chris Pronger</fx:String>
                <fx:String>Shane Doan</fx:String>
                <fx:String>Shea Weber</fx:String>
                <fx:String>Patrick Marleau</fx:String>
                <fx:String>Jay Bouwmeester</fx:String>
                <fx:String>Duncan Keith</fx:String>
                <fx:String>Dany Heatley</fx:String>
                <fx:String>Robyn Regehr</fx:String>
                <fx:String>Mike Richards</fx:String>
                <fx:String>Brenden Morrow</fx:String>
                <fx:String>Martin St. Louis</fx:String>
                <fx:String>Jeff Carter</fx:String>
                <fx:String>Eric Staal</fx:String>
                <fx:String>Sidney Crosby</fx:String>
            </s:ArrayList>
        </s:dataProvider>
        <s:itemRenderer>
            <fx:Component>
                <s:ItemRenderer>
                    <fx:Script>
                        <![CDATA[
                            import spark.components.List;
                            override public function set data(value:Object):void {
                                super.data = value;

                                if (value == null)
                                    return;

                                txtPlayer.text = String(data);
                                txtRowNumber.text = String(itemIndex);

                                // NOTE: In older builds ItemRenderer.itemIndex didn't exist yet.  If you are on an older
                                // build you can get this information using the following line instead:
                                //
                                //txtRowNumber.text = String((owner as List).dataProvider.getItemIndex(data));
                            }
                        ]]>
                    </fx:Script>
                    <s:Group>
                        <s:Rect width="25" height="20">
                            <s:fill>
                                <s:SolidColor color="0xFF0000" />
                            </s:fill>
                        </s:Rect>
                        <s:Label color="white" fontWeight="bold" horizontalCenter="0" verticalCenter="0" />
                    </s:Group>

                    <s:Label x="30" verticalCenter="0" />
                </s:ItemRenderer>
            </fx:Component>
        </s:itemRenderer>
    </s:List>

</s:Application>

分类:Flash 时间:2010-02-21 人气:241
分享到:
blog comments powered by Disqus

相关文章

  • spring IOC 2010-03-29

    IoC and DI First of all like to talk about IoC (Inversion of Control, control reverse). This is the heart of spring, through to the end. The so-called IoC, is the framework for the spring, that is, by the spring to be responsible for controlling the

  • IoC Containers and Dependency Injection pattern 2010-03-29

    IoC and DI First of all like to talk about IoC (Inversion of Control, control reverse). This is the heart of spring, through to the end. The so-called IoC, is the framework for the spring, that is, by the spring to be responsible for controlling the

  • FLEX embedded in the html code 2010-04-12

    <? Xml version = "1.0" encoding = "utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Image alpha="100" source="file:///C|/Documents and Settings/

  • Text Processing Study Notes 3 2010-06-17

    Environment as follows: python-2.5.2 python stand-alone program is frequently used for the analytical parameters, The following use locals () dictionary as a variable input parameters into the paramTest.py # coding:gbk import os import sys import tim

  • MyEclipse plug-in Keys 2010-07-27

    Eclipse is an open source, extensible IDE, has attracted a lot of industry attention, and the Eclipse supporters endless. It is one of the important benefits of scalability, well, you can expand the number of plug-ins, open source plug-ins and plug-i

  • jodconverter plain text files to pdf problem when the Chinese solution 2010-09-25

    jodconverter convert ms files are not found in the Chinese problem, but the conversion simple text file Shique Chinese problems arise. I started looking for a cpdetecter to detect text file encoding format, but the encoding format of some documents o

  • One study notes Flex (Flex Profile) 2010-11-29

    In order to improve the user experience, the emergence of a new type of Internet applications. That is Rich Internet Application. These applications combine fast response of desktop applications, the advantages of strong interactive Web applications

  • [Order] sql statement some practical tips for oracle 2010-03-30

    Finishing a book read long ago, and forgot what this was, now contributed. 1) In the select statement, use conditional logic 1select ename, sal, 2 case when sal <= 2000 then 'UNDERPAID' 3 when sal> = 4000 then 'OVERPAID' 4 else 'OK' 5 end as status

  • Flex4 instance - FXG and MXML graphics-building a game 2010-03-30

    Component: BoardDisplay.mxml <? xml version = "1.0" encoding = "utf-8"?> <Graphic xmlns: fx = "http://ns.adobe.com/mxml/2009" xmlns = "library: / / ns.adobe.com / flex / spark" xmlns: mx = "library: /

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.107 (s). 12 q(s)