打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
滚动到底部 flex list mobile

滚动到底部 flex list mobile

http://flexponential.com/samples/ScrollToBottom/srcview/

 

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

  xmlns:s="library://ns.adobe.com/flex/spark"

  viewSourceURL="srcview/index.html">

<fx:Script>

<![CDATA[

import spark.core.NavigationUnit;

 

private function addMessage():void {

// add the message

chatList.dataProvider.addItem({label:message.text});

 

// clear the text input

message.text = "";

 

// scroll to the bottom of the List to show this item

scrollToBottom();

}

 

private function scrollToBottom():void {

// update the verticalScrollPosition to the end of the List

// virtual layout may require us to validate a few times

var delta:Number = 0;

var count:int = 0;

while (count++ < 10){

chatList.validateNow();

delta = chatList.layout.getVerticalScrollPositionDelta(NavigationUnit.END);

chatList.layout.verticalScrollPosition += delta;

 

if (delta == 0)

break;

}

}

]]>

</fx:Script>

 

<s:Panel title="Chat" defaultButton="{btn}" horizontalCenter="0" verticalCenter="0" width="300">

<s:List id="chatList" alternatingItemColors="[#EEEEEE,#DDDDDD]" height="120" width="100%">

<s:layout>

<s:VerticalLayout horizontalAlign="justify" gap="0" />

</s:layout>

<s:dataProvider>

<s:ArrayCollection id="dp" />

</s:dataProvider>

</s:List>

 

<s:controlBarContent>

<s:TextInput id="message" width="100%" />

<s:Button id="btn" label="Send" click="addMessage()" />

</s:controlBarContent>

</s:Panel>

 

</s:Application>

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
flex DropDownList 的使用
RIA技术入门之Macromedia Flex & JSP(二)
InfoQ: Flex与JSON及XML的互操作
理解 Flex itemRenderer - 第 1 部分: 内联渲染器 - czx338...
flex的array和arraycollection
web前端开发之几种布局方式之响应式布局
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服