Tuesday, November 15, 2011

Flash Develop

I've just started using Flash Develop, not enough to give a decent review, but enough to say, 'Hey... I kinda' like this!' but it didn't start out so well... I figured, what better way to dive back into AS3 and get used to Flash Develop, than by going through Michael James William's AS3 Avoider Game Tutorial? So I started on section 1, everything was going great... FD booted right up, it asked me to create a package, and... oh crud, which one should I pick? AS3 Project? Flash IDE project? AS3 with Preloader? HaXe? ...what the heck is HaXe? I definitely don't want Haxe, I guess... right? No, no, course not...
Would you believe Michael helped me again? I found this post over on Active Tuts+ which explained which one was for me.

OK, Really getting started now
Ok, so my project is open and I jump right into section 1 of the AS3 tutorial. I scan down because a lot of the prep doesn't seem to apply... then I make my first enemy (using the Flash IDE), export the SWC, and import it into FD (the whole reason I jumped into FD in the first place - but that's for another story)
I'm just humming along now! I create a new class: Enemy.as and then I press Ctrl+Enter to test my 'game'!
...wait, there's no enemy on the screen! Where the heck is the enemy I just created? I check, double-check, TRIPLE check my spelling. I copy and paste from the tutorial.
Will. Not. Appear.
I remove the AS file from my project and add that code to my main AS file and now my enemy is there. ...huh?
Time to hit Google again... thankfully I found this post on One Giant Medias website before I went completely bald from frustration. It notes:
Using custom classes with the same names as linkage library movie clips in Flash IDE would trace output but not show up on stage
and then it goes on to explain how to get it working.
So, I went back to the Flash IDE, right-clicked my Enemy in the library and chose Linkage...
I changed the class to FL_Enemy, saved, and published the file.
Time to go back to Flash Develop, now open up that Enemy.as class file and change
public class Enemy extends MovieClip
public class Enemy extends FL_Enemy
...by the way, you don't have to pick FL_Enemy for the library class, it can be anything, but appending FL_ is a suggestion from the OneGiantMedia blog article. Of course, you'd have known that if you clicked the link above!

...back to programming!