当我关闭virtualLayout时,以下代码正常工作。但是,当我打开virtualLayout时,使用Tab键导航以下列表无法正确滚动。似乎Flex没有意识到新的itemrenrerers可用。想法?
<?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"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="firstComponent.setFocus()">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:TextInput id="firstComponent"/>
<s:List id="lst" hasFocusableChildren="true">
<s:layout>
<s:TileLayout requestedColumnCount="3" requestedRowCount="2"/>
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer focusIn="itemrenderer1_focusInHandler(event)">
<s:states>
<s:State name="normal"/>
<s:State name="selected" enterState="txt.setFocus();"/>
</s:states>
<s:layout>
<s:VerticalLayout paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.effects.AnimateProperty;
import spark.components.DataGroup;
import spark.components.List;
protected function itemrenderer1_focusInHandler(event:FocusEvent):void
{
var lst:List = List(owner);
var idx:Number = lst.dataProvider.getItemIndex(data);
lst.selectedItem = data;
// Make sure that the next item is visible
idx++;
if (idx < lst.dataProvider.length - 1)
lst.ensureIndexIsVisible(idx);
}
]]>
</fx:Script>
<s:Label text="Renderer"/>
<s:TextArea id="txt" text="@{data.text}"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
<s:dataProvider>
<s:ArrayCollection>
<fx:Object text="1"/>
<fx:Object text="2"/>
<fx:Object text="3"/>
<fx:Object text="4"/>
<fx:Object text="5"/>
<fx:Object text="6"/>
<fx:Object text="7"/>
<fx:Object text="8"/>
<fx:Object text="9"/>
<fx:Object text="10"/>
<fx:Object text="11"/>
<fx:Object text="12"/>
<fx:Object text="13"/>
<fx:Object text="14"/>
<fx:Object text="15"/>
</s:ArrayCollection>
</s:dataProvider>
</s:List>
</s:Application>