SWFMacMouseWheel - real world example
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 textArea components. It uses a simple hitTest to see if mouse is over the textArea and then increments the vPosition accordingly.
17 Comments so far
Leave a reply
Thank you very much! This is definately easy to implement, you saved my day!
I also like to thank you for making it a whole lot easier to implement. I now got it working. Whoohoo
you’re welcome! i’m glad it helps…
Thanks for making this example. I have a couple questions that maybe you can answer?
If I move the text area around the mouse wheel scroll stops working or works in a strange location (not over the TextArea). Should it matter where the TextArea is located?
Can this be done to a dynamic text/scroll box that isn’t a TextArea component?
It’s still a great example! Thanks
hey dave
i took a look at the example and changed the pos of the TextAreas to see if i could re-create what you describe…but everything seemed to work fine for me. i’m not sure what could be causing that. feel free to post an example if you have it and we’ll check it out further.
Yea, the scrolling of a TextField is possible but it wouldn’t work with the code in this example. The code is using properties specfic to the TextArea component, such as vPosition. So instead of “desc_txt.vPosition++” you’d probably have to use “desc_txt.scroll++”.
cheers
Hi Justin,
Thanks for taking the time to help me out.
Here’s my version of the example with the TextArea moved horizontally.
http://www.workalicious.com/mousewheelmove/index.html
It looks like (using the background tones as a guide) the distance moved plus the width of the scrollbar is the non-scrolling area in the new location of the TextArea or I’m totally crazy. Some kind of weird cache going on maybe?
http://www.workalicious.com/mousewheelmove/_source.zip
So I couldn’t stop messing with your example and I still don’t know what would be causing the odd shifting. But I did figure out that it has something to do with the instance of that TextArea myclip. When i “break apart” myclip and put the code on the first frame of the timeline with the individual TextArea instances I can move them around willy-nilly and all is good.
I made a new single version with that approach too:
http://www.workalicious.com/mousewheelmove/singleTextArea.html
http://www.workalicious.com/mousewheelmove/_singleVersion.zip
… hey i’m still checking this out, just dealing with some client stuff at the moment. will try to post what i find soon.
ok, apparently in the hitTest code you need to reference ‘this._parent._xmouse’ (etc) instead of just ‘_xmouse’ … that seems to fix the problem. I updated the code and reposted the download. thanks for bringing this to my attention!
oh that’s excellent. i was making a holder and doing the hitTest on there. Shifting and re-pathing… ‘this._parent._xmouse’ will keep everything much neater.
i’ve got a nice working version with the zMin scroller and a textbox. i hope i’m not mucking up the blog with a bunch of links, but here’s one more:
http://www.workalicious.com/dynamicHTML/
thanks justin!
Hey dave,
Do you have the FLA for that last link? Or if anyone else has utilized this code with something other than a text area component.
Thanks.
Hey Keven
i just added a datagrid to the example code to show usage of something other than the textArea… but it essentially works the same. let me know if this helps…
cheers
justin
Hi,
i found some “strange behaviours” in the SWFMacMouseWheel/TextArea:
1. if you scroll over the limit up or down, you need to scroll it back before the content scrolls again. I see that dave fixed the problem, how?
dave’s link: http://www.workalicious.com/dynamicHTML/
2. safari scrolls 3 lines and the other browsers 1, is there a way to fix it?
3. there’s no preloader that works with the textarea, why? it shows the loader only at the end.
4. when you load 2 or more textareas, obviously with swfmacmousewheel, and continue loading other stuff(example: next section loaded via loadMovieNum or loadMovie), the browsers (all) crash when you scroll somewhere on the site. (I unloaded all the stuff before loading the next content.)
thanx,
oshi
hey oshi
1. i’m not sure exactly how dave did it, but if i had to guess he may be resetting the mousewheel delta so the extra scrolling is not needed somehow … dave, how’d you do it?
2. (another guess)….the difference in scroll length between browsers may be from the way each browser registers mousewheel events.
3. how exactly do you want to use a preloader with the textArea? do you want the preloader to show while the text is loading into the component? or the loading of the swf with the textArea in it?
4. i’d like to see an example of this… i’ve had no problem using multiple instances of textAreas with the mouse enabled.
hi justin,
thanx for replying so quickly..
1. for the “unlimited scroller” let’s hope dave has a problem with swfmacmousewheel and pass by -)..
2. I known it’s a browser problem, but there must be a way to tell safari the right way..in the next link it’s exceptionally the opposite:
http://kockumcommunication.se/#/services/
3. my wish is to load a swf with a textarea in it..the only way I got it work is with an “old” textarea from flash mx..but I need a flash 8 textarea..
I tried also to set a preloader in the componet (via xml) but it shows exactly the same way, the preloader only at the end..
4. I have quite a mess in the files and if it works by you, the problem is surely in my mess..if I find the time to tidy up I will send you the code and link the content..
thanx
hey oshi
if you get your ‘mess’ cleaned up, let me know… maybe we can get it working.
send me a link…
thanks yourss free online live word tv to follow..