flex4中的Scroller,监听滚动事件
发布时间:2020-12-15 04:27:58 所属栏目:百科 来源:网络整理
导读:Scroller有水平滚动条horizontalScrollBar和竖起滚动条verticalScrollBar,监听change事件即可。 ?xml version="1.0" encoding="utf-8"? s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" ?? xmlns:mx="library://ns.adobe.com/flex/mx" ?? ? ? ? ?
Scroller有水平滚动条horizontalScrollBar和竖起滚动条verticalScrollBar,监听change事件即可。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
?? xmlns:mx="library://ns.adobe.com/flex/mx"
?? ? ? ? ? xmlns:s="library://ns.adobe.com/flex/spark"?
? ? ? ? ? ? ? ?creationComplete="init(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private function init(event:FlexEvent):void
{
trace("init");
scroller.verticalScrollBar.addEventListener(Event.CHANGE,onChange);
}
private var count:int = 0;
private function onChange(event:Event):void
trace("change" + count++);
]]>
</fx:Script>
<s:Scroller id="scroller" width="200" height="400">
<s:Group id="viewport" width="100%" height="400">
<s:Rect width="100%" height="3000">
<s:fill>
<s:LinearGradient rotation="90">
<s:entries>
<s:GradientEntry color="0x222222" ratio="0"/>
<s:GradientEntry color="0xDDDDDD" ratio="1"/>
</s:entries>
</s:LinearGradient>
</s:fill>
</s:Rect>
</s:Group>
</s:Scroller>
</s:Application>
转载:http://bbs.9ria.com/blog-185280-14037.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |