简体   繁体   中英

Highlight the first item in the tilelist in flex

I am navigating the items of tile list using next and previous button. I need to highlight the first item in the tilelist by default ( like the first item is being selected by default)

Just require selection, which will default select the first item:

<s:List requireSelection="true">
    <s:layout>
        <s:TileLayout />
    </s:layout>
</s:List>

Otherwise, you can set the selected index:

<s:List selectedIndex="0" />

Or...

<fx:Script>
    <![CDATA[
        public function selectFirstItem():void
        {
            list.selectedIndex = 0;
        }
    ]]>
</fx:Script>

<s:List id="list" />

Likewise if you're using the deprecated mx:TileList

<mx:TileList selectedIndex="0" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM