LoginSignup
3
3

More than 5 years have passed since last update.

Listのスクロールイベント取得と最後までスクロールしたかの判定

Posted at

List自体からスクロールの変化を取得することができなかったので
ViewPortの縦スクロールの値変化をチェックして判定するよう実装してみた。
e.propertyをhorizontal~にすれば横スクロールの判定もできそう。

<fx:Script>
<![CDATA[
    protected function creationComplete(e:FlexEvent):void{
        list.scroller.viewport.addEventListener( PropertyChangeEvent.PROPERTY_CHANGE, listPropertyChangeHandler);
    }

    protected function listPropertyChangeHandler(e:PropertyChangeEvent):void{
        // スクロール位置に変更があった
        if(e.property == "verticalScrollPosition"){
            var viewport:IViewPort = list.scroller.viewport;
            if(viewport.verticalScrollPosition == viewposrt.contentHeight + list.scroller.height){
                // 最後までスクロールした
            }
        }
    }
]]>

<s:List id="list"/>
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3