Posts Tagged flash
Flash ScrollPane Mouse Wheel Event
Posted by Scott in Adobe RIA, Blog, Web Browsers, Web Development on December 10, 2010
Getting the ScrollPane in flash to work with a mouse wheel can be tricky. It will not allow the mouse wheel to scroll if there is not acutal content right underneath the mouse pointer. This can be cumbersome for dynamic content in the pane. To fix this, you can use the following AS3 code to scroll the ScrollPane without having to mess with background sizes in the pane.
1: // Listen for mouse wheel event on the stage to scroll content
2: stage.addEventListener( MouseEvent.MOUSE_WHEEL,
3: function( event:MouseEvent ):void
4: {
5: if( scrollPane !== null )
6: {
7: scrollPane.verticalScrollPosition += - ( event.delta * 8 );
8: }
9: });
You can adjust the “( event.delta * 8 )” to only “event.delta” if you don’t want to change the amount of scrolling that is performed.
Flash and the Scroll Wheel in the Browser
Posted by Scott in Adobe RIA, Blog, Web Browsers, Web Design, Web Development on December 9, 2010
I have built many AS3 flash apps before, but on this one project I needed to enable scrolling with the mouse wheel. I added a flash scrollpane but it would not respond to the mouse wheel. So I tried adding an event listener to the entire stage to see if I could capture any mouse wheel event. No luck with that either. Countless searches turned up maybe two possible resolutions to the problem, but they did not work either.
The resolution was out there to find, but I did not find it because I didn’t use the right keywords.
The resolution revealed to me was the parameter called “wmode”. The wmode param has three values; opaque, transparent, window(default). While normally most people do not set this parameter, I have a habit of setting it due to it’s necessity when building flash widgets for various web pages. In this case, if you set wmode to either transparent or opaque, the flash will not detect the mouse scroll wheel at all. So be sure not to set this parameter. If you do set it to “window” otherwise your flash app will not detect the mouse wheel events.
Book Review: Programming Flex 2
Posted by Scott in Books, Web Development on November 24, 2007
The Adobe Flex framework has taken the flash platform and made it more malleable for the web application developer. Flex uses XML and Actionscript 3.0 to rapidly build rich internet applications in the widely accepted SWF format. The Programming Flex 2 book from O’Reilly takes the Flex framework and provides a strong foundation in which to understand and build Flex-based applications. Read the rest of this entry »
