Sunday, September 05, 2010

SWCs and FlashDevelop, Part 2

Quite a while back, I wrote about the method I was using for developing using SWCs and FlashDevelop. At that time, I was discussing using inheritance (an "is a" relationship) and the issue of which direction the inheritance went: write in FlashDevelop and have the Flash MovieClip extend from it, or create the MovieClip and have the code in FlashDevelop extend from that. I found my preferred approach is: neither.

I have migrated to a style I used when I was developing in Director and Lingo. In Director, I'd have my Parent Script's using artwork. In other words, a "has a" relationship (also known as "aggregation"). So now I'll create a class in FlashDevelop, have it extend Sprite (or MovieClip), and then that class will create and use an instance of a MovieClip from the SWC as a child.

I've used all of the above approaches over the years, and I'm sure I'll still find times I'm choosing one of the "is a" methods. But for the moment, "has a" is working best.