getScrollTop()

8 views
Skip to first unread message

Mikael Emtinger

unread,
Mar 25, 2010, 10:58:09 AM3/25/10
to SWFFit
Hey!
Wanted to get the position of the upper left corner and, happily,
found the SWFFit should do it now. Downloaded the latest beta but
couldn't find the methods... Is it just the wrong files or am I
missing something?

BTW: would it be possible to get an event when the scrollTop/
scrollLeft has changed?

Thanks for a great library!
/m

Miller Medeiros

unread,
Mar 25, 2010, 6:18:00 PM3/25/10
to swf...@googlegroups.com
the methods swffit.getScrollLeft() and swffit.getScrollTop() returns the amount the page was scrolled in pixels (scroll bar position), it should return 0 in case the user didn't scrolled the page yet.

check the last lines of swffit source code: http://github.com/millermedeiros/swffit/blob/v2.4b/swffit/src/swffit_source.js  - it's there.

until now swffit doesn't have the option to attach an "onscroll" event listener but version 3.0 will... to do it right now you will need some extra JS:

http://github.com/millermedeiros/MM_js_lib/blob/master/src/framework/MM_event-listener.js

// -- how to use -- //

MM.event.addListener(window, 'scroll', onScrollHandler);  //add crossbrowser 'onscroll' Event listener

//this function will be called everytime the user scrolls the page
function onScrollHandler(){
    //the magic happens here
}

// -- end how to use -- //

good luck!

--
Miller Medeiros  |  www.millermedeiros.com  |  blog.millermedeiros.com

Mikael Emtinger

unread,
Mar 27, 2010, 11:24:57 AM3/27/10
to SWFFit
Thanks!
I found the functions in the JS right after posting, what I was
looking for was the AS3-functions that called the JS-functions. I've
now added them locally and it works fine. I've also added a window
height/width to be able to get the lower right corner as well. I
haven't been able to properly test it, but it seems to work. Maybe
that's something you should consider adding, as well.

Thanks again for a great lib!
/m


On Mar 25, 11:18 pm, Miller Medeiros <millermedei...@gmail.com> wrote:
> the methods swffit.getScrollLeft() and swffit.getScrollTop() returns the
> amount the page was scrolled in pixels (scroll bar position), it should
> return 0 in case the user didn't scrolled the page yet.
>

> check the last lines of swffit source code:http://github.com/millermedeiros/swffit/blob/v2.4b/swffit/src/swffit_...


> - it's there.
>
> until now swffit doesn't have the option to attach an "onscroll" event
> listener but version 3.0 will... to do it right now you will need some extra
> JS:
>

> http://github.com/millermedeiros/MM_js_lib/blob/master/src/framework/...

Reply all
Reply to author
Forward
0 new messages