Scroll Event issue with HScrollBar

7 views
Skip to first unread message

Ravi

unread,
Dec 28, 2009, 12:44:36 AM12/28/09
to Flex India Community
Hello Friends,
I am using HscrollBar in my application.
In which on Scroll event i am calling (webService) some function.
But this function get call multiple times because Scroll event.
because of that i didnt get response in quick time and gets error
Channel Disconnected.
I want to call this function once at mouse down.but MouseDown events
get fire only if mouse pointer is on HScrollBar.and also i didnt get
scroll position on MouseDown event. It only gets in OnScroll Event.
can somebody please help me in this...

thanks in advance
ravi

Message has been deleted
Message has been deleted
Message has been deleted

Ravi

unread,
Dec 31, 2009, 2:40:59 AM12/31/09
to Flex India Community

Shobita

unread,
Jan 2, 2010, 8:03:44 AM1/2/10
to Flex India Community
Remove the event listener in the handler. You can add it again later

private function onScroll(event:Event):void
{
event.currentTarget.removeEventListener(ScrollEvent.SCROLL,
onScroll);

// webService call
}

Make sure you add the event lister in AS and not mxml.

Ravi

unread,
Jan 4, 2010, 2:06:37 AM1/4/10
to Flex India Community
thanks for reply shobita,
can you please explain me in detail....Because if we remove the
listener then also it will hit webService call again n again on
scroll.Please correct me if i am wrong..waiting 4 ur reply

thanks in advance
ravi

Shobita

unread,
Jan 5, 2010, 12:08:32 AM1/5/10
to Flex India Community
Since you will be calling the webService inside the event handler, it
will be called only the 1st time. There after the handler will not be
invoked.
Reply all
Reply to author
Forward
0 new messages