SWFObject add-on: MouseWheel on Mac OS
I've had the mouse wheel working in flash on OS X for a while, and after seeing the SWFAddress add-on for deconcept's SWFObject embedding system, I thought I'd add mousewheel functionality to SWFObject, rather than using my own "frankenstein" embedding system.
It's straight forward to implement. Download SWFMacMouseWheel here.
Within ActionScript, you'll barely notice any difference. Only that instead of using Mouse.addListener(), you'll refer to my class instead.
Example code:
Actionscript:
-
import com.pixelbreaker.ui.MouseWheel;
-
-
class Example
-
{
-
-
function Example(){
-
MouseWheel.addListener( this );
-
}
-
-
public function onMouseWheel( delta:Number ):Void
-
{
-
// do something with the delta value
-
}
-
}
All the javascript is included in the zip, with an example html file.
You simply have to add one line of code to the javascript:
JavaScript:
-
var so = new SWFObject('test.swf', 'website', '100%', '100%', '8', '#FFFFFF');
-
-
so.useExpressInstall('js/expressinstall.swf');
-
-
so.addParam('menu', 'false');
-
so.addParam('scale', 'noscale');
-
so.addParam('salign', 'lt');
-
-
// CHANGE BELOW
-
if( so.write('flashcontent') )
-
{
-
var macmousewheel = new SWFMacMouseWheel( so );
-
}
85 Comments so far
Awesome, this is actually very useful... we have clients all the time that want mouse wheel support on macs.
Hi Geoff, glad it's of use. I've also got a little class that allows flash movies to be 100% of the browser, but not go below a certain size, I'll make that work along side SWFObject in the next week, I'll let you know when it's done.
Thanks for bringing mouse wheel support publicly to the mac :).
I'll start integrating it when I switched to swfObject, which brings me to your own reply, I need that 'not go below a certain size' functionality. I have it already, but by switching over to SWFObject, I have to reimplement it.
I'll be checking your blog a lot from now on, and I hope you have it sooner then next week, as I'm currently in the process of adapting the code... which would same me a some time and trouble.
(Or maybe you could send me the beta code, in which I can help test and bug hunt.)
thanks!
[...] Extending Flash support in browser is the new black these days. Pixelbreaker adds a very welcome addition by extending support for the mouse wheel in Flash to the Macs with is own MouseWheel extension. Finally mouse wheel support is no longer Windows only! [...]
[...] ya puedes utilizar la ruedecita del ratn desde flash en mac aqu esta el “truco” [...]
hi zokdok, I'll get it done asap, just i'm finishing my current employment tomorrow, so big party tonight, gonna be a bit tricky to get anything done before sunday...
[...] pixelbreaker SWFObject add-on: MouseWheel on Mac OS (tags: flash actionscript swfobject mousewheel osx) [...]
Hi Pixelbreaker, thanks a lot for the script!!!, Is there any way to use it without swfObject? (some layouts just make it hard to use swfObject)
Also, this will work only with Flash 8 and up?
thanks again!.
It should work fine with Flash 7, you just have to be using ActionScript 2.0. The version available above will only work with SWFObject. I've not had any issues using SWFObject with different layouts.
Hi,
It seems it doesn't run on Safari 2.0.4, flash Player 9
I'm running it on Safari 2.0.4 here, and it's fine.
[...] Mac ScrollWheel Support [...]
With Safari, I get this message when opening the sample:
str:
onMouseWheel: [type Function]
$version: MAC 9,0,16,0
mouse_txt: _level0.mouse_txt
test_txt: _level0.test_txt
Using Firefox 2.0, I'm getting the "You need to upgrade your Flash Player!" message.
With Safari, I get this message when opening the sample:
str:
onMouseWheel: [type Function]
$version: MAC 9,0,16,0
mouse_txt: _level0.mouse_txt
test_txt: _level0.test_txt
Also, when using Firefox 2.0, I'm getting the "You need to upgrade your Flash Player!" message.
Dave, the flash detection is working in firefox 2.0 on Windows and OS X for me, maybe you should direct questions for that to deconcept (who made the detection scripts).
The message you see in safari is correct, that's what my test movie shows... once you scroll the mouse wheel, you should see another textfield to the right, echoing some numbers, depending on which direction you're scrolling your wheel.
Hope you get it sorted...
Pixelbreaker, thanks for the response...
Still not seeing any changes when scrolling though, (using Safari). Has anyone else had trouble with this? I'd love to see it working!
[...] A couple of weeks ago pixelbreaker released a kick-ass add-on to SWFObject called SWFMacMouseWheel which enables the mousewheel support in Flash for OSX. I was a little bummed on their example code though… so I’ve created a little example of some scrolling textFields. It uses a simple hitTest to see if mouse is over the textField and then increments the vPosition accordingly. example [...]
This is great. Thank you very much.. I posted it on Digg.com
http://digg.com/programming/Mouse_wheel_support_in_Flash_finally_on_Mac_OS_X
Great work!
It works on safari 2.0.4 and OSX 10.4.8.
Hi, I too am getting the same response as Dave, I see the textfields on the top left but when I use the mouse scroller I don't see anything changing, this happens when I use firefox or Safari. I'm running FP 9 in both cases.
Both the example SWF and my own attempts both fail to show output from the scrollwheel.
Any ideas?
Hi... I also had the same Problem lke Dave and Kev, using Saf 2.0.4 or Firefox 2.0...
LOCAL... it has to be online (on the Server) to work!!!
Thx, it's great!
Pedro, you probably have to change your flash player security settings and allow "c:\" if you're on PC or "Macintosh HD" if you're on mac.
You might want to change the main() to init() or something when you're used to work with mtasc (like me).
While working with Flex 2 on a AS3 project a textfield suddenly scrolled by wheel - and this on the MAC!!! standalone debug player. Also MouseEvent.MOUSE_WHEEL is broadcasted. Although the mac mouse wheel support is still missing in the flash plugin itself (9.28), it seems to be in the pipe now!
[...] Extending Flash support in browser is the new black these days. Pixelbreaker adds a very welcome addition by extending support for the mouse wheel in Flash to the Macs with is own MouseWheel extension. Finally mouse wheel support is no longer Windows only! [...]
[...] » Läs mer på pixelbreaker.com. [...]
[...] Part of eepmon version 3 allows the user to use their mouse wheel to scroll through content. Works great in Windows but no go on a MAC. So I’ve done a google search and stumbled upon pixelbreaker’s site where he has resolved the mouse wheel conflict. [...]
Hello,
I am creating my new version of my site and the mouse wheel is working perfectly on Firefox. It also works in Safari but it seems to be dispatching mouse wheel event twice causing the navigation to skip every 2nd item. Could this be a browser issue? Has anyone come across this?
Thank you
[...] Mac OSX Support [...]
[...] Get all the info here [...]
hi,
i'm trying to add the mousewheel to my movies. first of all i want to get something like your test.swf made by me, but i'm having some troubles.
i'm just making a new flash movie, named test.swf and overwrite yours. on the movie i'm making on the first frame
i'm adding all the example code you detail on the top of this site like this:
import com.pixelbreaker.ui.MouseWheel;
class Example
{
function Example(){
MouseWheel.addListener( this );
}
public function onMouseWheel( delta:Number ):Void
{
myTextField = delta;
}
}
first problem. Flash debugger is telling me that i can only define classes in AS external scripts.
.. i'm not very used to work with classes, so i try only
leaving the first line (import com.pixelbreaker.ui.MouseWheel;) in the flash movie and placing the rest of the code at the end of the mouswheel.as file ... i also define into the publication configuration menu of the flash movie the folders where all the .as files are contained..
it doesn't work too.
please, explain me better how could i use this very usefull code or upload the test.fla.
thanks you
sorry, there's some more.
the firefox debugger keeps telling me these everytime the mousewheel is moved:
document[this.so.getAttribute("id")].externalMouseEvent is not a function
[Break on this error] document[ this.so.getAttribute('id') ].externalMouseEvent( delta );
thanks again.
クロスプラットフォーム Flashスクロールクラス&JS Beta...
ジミーな研究。 ■Flash8のスクロール関係コンポーネントがどうも使いづらい。......
thenk you
I have desccovered a bug with this code with the undocumented scrollTarget parameter onMouseWheel event. Basically this param tells you what movieclip the mouse is currently over. The following code fixes this if this could be updated in the source it would be a good idea.
The solution is a bit of a hack but it works
private public static function externalMouseEvent(delta:Number):Void
{
var st:MovieClip = _root.createEmptyMovieClip("st", _root.getNextHighestDepth());
st.startDrag();
//
st.func = macBroadcaster.broadcastMessage;
st.scope = macBroadcaster
st.args = ["onMouseWheel", delta];
//
st.onEnterFrame = function() {
//
this._x = _root._xmouse;
this._y = _root._ymouse;
//
if (this._droptarget != "" && this._droptarget!= undefined) {
//
this.args.push(eval(this._droptarget));
this.func.apply(this.scope, this.args);
//
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
Sorry typo in the above change that first line from
private static function externalMouseEvent(delta:Number):Void
{
var st:MovieClip = _root.createEmptyMovieClip("st", _root.getNextHighestDepth());
st.startDrag();
//
st.func = macBroadcaster.broadcastMessage;
st.scope = macBroadcaster
st.args = ["onMouseWheel", delta];
//
st.onEnterFrame = function() {
//
this._x = _root._xmouse;
this._y = _root._ymouse;
//
if (this._droptarget != "" && this._droptarget!= undefined) {
//
this.args.push(eval(this._droptarget));
this.func.apply(this.scope, this.args);
//
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
[...] Now getting Scroll Wheel to work on Mac is a little trickier as Flash doesn’t have native support for this but there is a way to get this to work in Flash 8. The Javascript and Actionscript provided code from PixelBreaker as a SWFObject add-on allows you to do this. It’s pretty good but has one shortcoming and that is that it only provides the delta parameter and not scrollTarget, I have an Actionscript fix for this and it’s a bit of a hack but hey it works, I hope u find this useful. [...]
I have still problems with the code, anyone can solve it? thanks
Great work man, you saved my ass!
I'm not such an experet, but i did it to work in a couple of hours.
Thanx again
hi_gui
Shane, good that you got scrolltarget working, I never use it, and creating _root movieclips is too hacked for my liking. By all means, publish your own version of the code.
cheers
[...] SWFMacMouseWheel [...]
[...] UPDATE As the Flash Player for Macs doesn't have support for Mousewheel events, I have updated the source code with a mac version which uses a javascript workaround. You'll also need to download the SWFMacMouseWheel class from pixelbreaker. I have tested it on Mac OS X Safari and Firefox, works fine. To install the class, copy the "com" folder and paste it into your Actionscript 2.0 class folder. Typical paths are Windows: Hard DiskDocuments and SettingsuserLocal SettingsApplication DataAdobeFlash CS3languageConfigurationClasses Macintosh: Hard Disk/Users/user/Library/Application Support/Adobe/Flash CS3/language/Configuration/Classes [...]
nice work
Thank you
thank you very much webmaster for nice site. i am reading all write. thanks again. works is very nice
[...] This extra also showcases the use of the SWFMacMouseWheel javascript, by PixelBreaker. By using this javascript, MAC users can also scroll through the playlist with their mousewheel. [...]
I'll admit, I'm no actionscript pro so if anyone has used this fancy mousewheel stuff with a custom scrollbar such as this:
http://www.kirupa.com/developer/flash8/scrollbar.htm
can you please let me know.
Thanks
I want to use vista.. but my os don't support them!
youtube
mirc
radyo
mirc
sohbet
sohbet
Works great in Safari, but on Windows with IE, the scroll wheel doesn't work until you click on something (activeX). The swfobject.js doesn't work for the scrollwheel.
thanks for all
thanks :)
thx for all
Wow, this is a great release. I won't have that much use for the resizable columns, but the new feed navigation is really great for me!
It's very good article. Great site with very good look and perfect information... Thanks
Works great in Safari, but on Windows with IE, the scroll wheel doesn't work until you click on something (activeX) The swfobject.js doesn't work for the scrollwheel...
Wow, this is a great release. I won't have that much use for the resizable columns
It's very good article. Great site with very good look and perfect information.
Thnks...
Wow, this is a great release. I won't have that much use for the resizable columns, but the new feed navigation is really great for me!!!
Murat Boz
the firefox debugger keeps telling me these everytime the mousewheel is moved:
document[this.so.getAttribute("id")].externalMouseEvent is not a function
[Break on this error] document[ this.so.getAttribute('id') ].externalMouseEvent( delta );
thanks again...
Grup Hepsi
I'll be checking your blog a lot from now on, and I hope you have it sooner then next week, as I'm currently in the process of adapting the code... which would same me a some time and trouble.
(Or maybe you could send me the beta code, in which I can help test and bug hunt.)Sohpet
thank you
the firefox debugger keeps telling me these everytime the mousewheel is moved:
document[this.so.getAttribute("id")].externalMouseEvent is not a function
[Break on this error] document[ this.so.getAttribute('id') ].externalMouseEvent( delta );
thanks again...
Thank you very much
I'll admit, I'm no actionscript pro so if anyone has used this fancy mousewheel stuff with a custom scrollbar such as this:.
mp3indir
zirve
thanks
Hi, I'm Turkish science communicator.I like very very much Nature Podcast.
Congratulations!
Hi. I found your site a while back when I was looking for existing solutions for OS X mouse wheel support, but found none that would be easily plugged to Flex/AS3 apps, so I implemented one myself. You can find it here:
http://hasseg.org/blog/?p=3
Hi. I also had the same Problem lke Dave and Kev, using Saf 2.0.4 or Firefox 2.0.
Local. it has to be online (on the Server) to work
Does that mean, using your example class, I would state: mouseListener = new Example(); Mouse.addListener(mouseListener);? If not, then what?
Thanks.
Hi.
[...] A couple of weeks ago pixelbreaker released a kick-ass add-on to SWFObject called SWFMacMouseWheel which enables the mousewheel support in Flash for OSX. I was a little bummed on their example code though… so I’ve created a little example of some scrolling textFields. It uses a simple hitTest to see if mouse is over the textField and then increments the vPosition accordingly. example [...]
Hello, I too am getting the same response as Dave, I see the textfields on the top left but when I use the mouse scroller I don't see anything changing, this happens when I use firefox or Safari. I'm running FP 9 in both cases. dini sohbet
thanx
thanks for all knowledge
[...] SWFMacMouseWheel [...]
thanks good [...] SWFMacMouseWheel [...]
Shane, good that you got scrolltarget working, I never use it, and creating _root movieclips is too hacked for my liking. B
[...] pixelbreaker : SWFObject add-on: MouseWheel on Mac OS I’ve had the mouse wheel working in flash on OS X for a while, and after seeing the SWFAddress add-on for deconcept’s SWFObject embedding system, I thought I’d add mousewheel functionality to SWFObject, rather than using my own “frankenstein” embedding sy (tags: actionscript javascript swfobject MouseWheel mac flash) [...]
[...] en ai profité pour utiliser le javascript swfmacmousewheel.js qui permettrait à la mousewhell mac de fonctionner sur flash (impossible de vérifier je suis sur [...]
[...] tried to use the fix to make the mouse wheel work in Flash when you use Mac OS X that can be found here. But that didn’t do it. My last option was to use the new technique from the makers of [...]
Top 6 Flash Development Tools...
1) Fuse Kit For movieClip tweening I’ve been using the Zigo Tween engine until I saw Moses Gunesch at the Flash Forward conference in Austin showing off this amazing set of classes. Fuse is built upon the Zigo engine and......
[...] Gabriel Bucknail created almost a year ago a SWFObject add-on to bring MouseWheel support to the Mac OS X Flash Player. Seems to be still up to date: Solution [...]
AS3でSWFMacMouseWheelを作ってみたよ。...
SWFMacMouseWheel がAS2にしか対応してないらしくて、
勢いでAS3に対応したヤツを作ってみたよ。
使い方はある程度真似てみたんだけれども、
AS2を知らないので何とも。
AS側の使い...
[...] (via FTween). There is a textpanel there, too. Sorry, no buttons on the scrollbar. You are using swfmacmousewheel, [...]
software gioco poker...
Still best credit card debt help telecharger poker superstars...
[...] UPDATE: I was curious, so I did a quick search and discovered that someone figured out how to get the Mouse Wheel to work in Flash on a Mac through SWFObject. BooYah. [...]