00:00
00:00
WarpZone

Age 44, Male

Joined on 1/26/05

Level:
14
Exp Points:
2,076 / 2,180
Exp Rank:
29,044
Vote Power:
5.62 votes
Rank:
Police Officer
Global Rank:
13,257
Blams:
268
Saves:
454
B/P Bonus:
10%
Whistle:
Bronze
Trophies:
1
Medals:
717

AS 3.0 breakthrough

Posted by WarpZone - October 1st, 2007


It's taken me a long time to catch up, but I've finally started to make some headway into understanding AS 3.0. It's taken me a while to get into it, but can you blame me? The online tutorials are skimpy, the official tutorials seem almost deliberately obtuse, and the community, while enthusiastic, is kinda small. It doesn't help any that they made subtle tweaks to virtually every keyword you're used to using. Well, almost. Unary and Boolean operators still work the same, and the Math object made the transition strangely unscathed. But other than that, all of your old tricks are now illegal.

Here's a tip: Don't follow the tutorials blindly. You CAN still put code in the main timeline, or even (shame on you!) in movieclips on the stage, but you'll need to learn the new syntax in order to do it. You can't attach code to Objects anymore, which was one of the few elegant things about AS 2.0 (from a flash developer's point of view.) I'm 90% sure it's impossible to run a block of code per enemy per frame without creating an official class the OOP way. That's certianly how I did it. At least, for objects I spawn a lot of such as bullets and enemies. The player and lone background objects, I just implemented in the main timeline using AS3 as a scripting language. I may transition them to OOP later and see if the game gets even faster or not.

I understand the biggest speed boost in 3.0 is won by eliminating the MovieClip class from your game altogether, but I haven't quite figured out how to do animations with Sprites yet. The tutorials on Sprite games are absolute rubbish, by the way. They assume you want to store all your graphics in some damned web directory, thus making SWF-only portals like Newgrounds difficult to accomodate.

This is what happens when you try to turn a Graphic Design Utility into an Enterprise Language. It's just Adobe being greedy, of course. But in the end, Java's still slightly faster and better documented, so I can't see the professional programmers adopting it no matter how logical the API is. All they've done is alienate the community that put Flash on the map in the first place.

Well, despite the upgrade, I'm working on a little Halloween game right now. The AS 3.0 version runs faster than I ever dreamed... but the screen updates are a little uneven. Hopefully I'll improve upon that as I grow more experienced. I'd like to use screen flipping or double-buffering or something, but I think I read somewhere that that only works in full-screen mode. I don't remember. Oh well, I'm sure I'll figure it out.

It was a pain in the ass to learn, but the worst is behind me. From here on in, Things can only keep getting better and better. :)

And after seeing the improved performance, I don't think I'll ever want to go back to 2.0.

AS 3.0 breakthrough


Comments

Comments ain't a thing here.