눈부시도록 아름다운 그래서 바라볼 수 없는

List - scroll

study/flex 2013. 1. 23. 11:14

출처 : http://soenkerohde.com/2011/02/detect-spark-list-control-scroll-to-end/



<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="applicationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.IList;
import mx.events.FlexEvent;
import mx.events.PropertyChangeEvent;
[Bindable]
private var dp : IList;
 
protected function applicationCompleteHandler( event : FlexEvent ) : void {
var a : Array = [];
var count : int = 0;
while ( ++count <= 100 ) {
a.push( "Foo " + count );
}
dp = new ArrayCollection( a );
}
 
protected function list_creationCompleteHandler( event : FlexEvent ) : void {
// Does not work with mouse wheel or arrow buttons due to bug http://bugs.adobe.com/jira/browse/SDK-26533
/* list.scroller.verticalScrollBar.addEventListener( Event.CHANGE, verticalScrollBarChangeHandler ); */
list.scroller.viewport.addEventListener( PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler );
}
 
protected function propertyChangeHandler( event : PropertyChangeEvent ) : void {
if ( event.property == "verticalScrollPosition" ) {
if ( event.newValue == ( event.currentTarget.measuredHeight - event.currentTarget.height )) {
trace( "scrolled to end" );
}
}
}
]]>
</fx:Script>
 
<s:List id="list"
height="100%"
creationComplete="list_creationCompleteHandler(event)"
dataProvider="{dp}"/>
 
</s:WindowedApplication>


Posted by 휘루걸음

댓글을 달아 주세요