|  | Scrolling Flash Content With Mouse Scroll Bar |  | |
| | | JessePinuelasJr |  |
| Posted: Thu Jun 05, 2008 5:37 pm Post subject: Scrolling Flash Content With Mouse Scroll Bar |  |
| I created a custom scroll bar in AS2.0 and it works great. But now I would like the content to scroll with the mouse scroll wheel. Any ideas? |
| |
| | | Bob Pierce |  |
| Posted: Thu Jun 05, 2008 6:39 pm Post subject: Re: Scrolling Flash Content With Mouse Scroll Bar |  |
Something along these lines:
this.mouseListener = new Object(); Mouse.addListener(this.mouseListener);
this.mouseListener.onMouseWheel = function(delta:Number) { // add your actions here }; |
| |
| | | JessePinuelasJr |  |
| Posted: Thu Jun 05, 2008 7:03 pm Post subject: Re: Scrolling Flash Content With Mouse Scroll Bar |  |
| Awesome! I will give it a go and post the results. Thanks alot |
| |
| | | JessePinuelasJr |  |
| Posted: Thu Jun 05, 2008 10:58 pm Post subject: Re: Scrolling Flash Content With Mouse Scroll Bar |  |
Ok, so the scrolling part works now, but how do I set the scroll to the height of the mc that I am scrolling?
var mouseListener:Object = new Object (); mouseListener.onMouseWheel = function (delta) { contentMain._y += delta; }; Mouse.addListener (mouseListener); |
| |
| | | JessePinuelasJr |  |
| Posted: Wed Jun 11, 2008 9:36 pm Post subject: Re: Scrolling Flash Content With Mouse Scroll Bar |  |
Anyone know how to fix this on Mac Osx, it works in preview but not in safari. Any pointers?
var mouseListener:Object = new Object (); mouseListener.onMouseWheel = function (delta) { //contentMain._y += delta; scrollFace._y -= delta; if (scrollFace._y >= bottom) { scrollFace._y = bottom; } if (scrollFace._y <= top) { scrollFace._y = top; } updateContentPos (); }; Mouse.addListener (mouseListener);
function updateContentPos () { var onePercent = (bottom - top) / 100; var scrollPerc = Math.floor ((scrollFace._y / onePercent) - 37); var contentNewY = (contentMain._height * scrollPerc) / 100; //trace (scrollPerc + " " + contentNewY) contentMain._y = -contentNewY; } |
| |
|
|