Flex - How to detect scrolling

914 Views Asked by At

I have Scroller and in this scroller I have 3 swfloaders. How I can detect when scroll bar is scrolled on (event, my be)?

//edit

Sorry for the little information. In scroller I have Group

code:

<s:Scroller>
   <s:Group>
        <SWFLoader source="movie1.swf"/>
        <SWFLoader source="movie2.swf"/>
        <SWFLoader source="movie3.swf"/>
    </s:Group>
</s:Scroller>

but Scroller is custom (dragabble). Is possible ?

//

Thanks.

2

There are 2 best solutions below

1
On

its a simple one just call the scroll method of scrollbar.

might be the this link will going to be useful to you.

Have @ nice day, for best answer provide your code.

0
On

You may use this approach to apply custom scrolling to any component.

<?xml version="1.0" encoding="utf-8"?>

        protected function button1_clickHandler(event:MouseEvent):void
        {

            id_Scroller.viewport.verticalScrollPosition = id_Scroller.viewport.verticalScrollPosition + 15;
            lbl.text = id_Scroller.viewport.verticalScrollPosition.toString();
        }

        protected function button2_clickHandler(event:MouseEvent):void
        {
            id_Scroller.viewport.verticalScrollPosition = id_Scroller.viewport.verticalScrollPosition - 15;
            lbl.text = id_Scroller.viewport.verticalScrollPosition.toString();
        }

    ]]>
</fx:Script>
<s:Panel width="600" height="600">

    <s:layout>
        <s:VerticalLayout />
    </s:layout>

    <s:Scroller id="id_Scroller" width="100%" height="100%" verticalScrollPolicy="off" >

        <s:Group id="id_patientExamArea"  width="100%" height="100%" >
            <s:Panel width="100%" height="800" backgroundColor="#FFCCFF" title="test Up panel"/>
        </s:Group>
    </s:Scroller>
    <s:HGroup >
        <s:Button label="Up" click="button1_clickHandler(event)"/>
        <s:Button label="Down" click="button2_clickHandler(event)"/>
    </s:HGroup>
</s:Panel>
<s:Label id="lbl" x="774" y="62" />