Idiocracy is alive and well. ;]
I'm reminded of something Alan Kay said: "Simple things should be simple, complex things should be possible."
Flash fails the first half of this maxim. Fails it constantly. Simple things are almost never simple in Flash.
Other fun gotchas for the beginning AS3 programmer that have bit me (again) today:
- Your Flex app has to sub-class Sprite to get a pointer to the stage (WHY??), but if you attempt to use the "this" object as a sprite (instead of declaring a variable and doing "var = new Sprite()") or do something like this.stage.addChild(this), weird things happen. Some things don't work right, some things don't work at all. You know, the standard Adobe Flash BS.
Is there any documentation about this? HELL NO. Why would Adobe want to document something that will be a huge, nasty, evil stumbling block in the way of beginning Flex programmers? You're not paying them for their software, so they don't give a shit.
You wanna know how you end up having to make .focusRect work on a Sprite?
var mySprite:Sprite = new Sprite();
// Put something in the sprite. Remember, Flash will *SILENTLY IGNORE*
// some function calls / property changes on a blank sprite!
mySprite.buttonMode = true;
mySprite.focusRect = true;
mySprite.useHandCursor = false; // Not strictly necessary
public function onRollover(me:MouseEvent) : void
stage.focus = mySprite; // Yes, you REALLY DO have to manage this by hand! :P
public function onRolloff(me:MouseEvent) : void
stage.focus = null;