Since I’ve started playing around with the Unity game engine, I much prefer C# than JS for scripting. This is probably because I’m coming from an ActionScript background, but I’ve always cringed at the loose typing in JS. If I’m coerced to do any JS, I usually prefer cooking it up with TypeScript, too. Call me stoical, but that just feels more like a real programming language – yeah I said it!
JS does have a ‘low centre of gravity’, since everyone and his dog seems to be rocking JS now. But I’d encourage anyone starting out with Unity to give C# a chance.
Update: This project is now hosted at GoogleCode
I recently stumbled over a new AS3 gotcha that seems to be bugging a lot of the Flash community. Apparently a new ‘feature’ of AS3, whereby using the mousewheel inside an embedded Flash movie still scrolls the surrounding browser window (if it has enough content, that is).
This didn’t happen in AS2. If a Flash movie had focus, mousewheel events weren’t sent to the browser window. It wasn’t a problem in FireFox either, until a recent update and adversely affects any AS3 Flash app embedded in an HTML page where you might want to scroll or zoom with the mousewheel while over the Flash, instead of the scrolling the browser window.
Setting up MouseWheelTrap is easy:
Download the MouseWheelTrap ZIP package, or just the AS file.
Unzip the package and have a look at the demo, or just take the MouseWheelTrap.as file and put it in the com.spikything.utils folder into your own project or classpath.
Import the utility and set it up somewhere in your main class like so:
Simple huh? Let me know how you get on…