IntroductionVeteran 4GL programmers, OO Framework gurus, and other geeks far and wide would gasp and pale if they knew what implications the title of this article brought with it. Given the combination, and the often over trusted Object Oriented promises of ActionScript 2.0, anyone with a solid programming background would be a bit surprised, at the very least, by the behavior of this 'MovieClip Monster'. The reasoning behind giving the MovieClip a 'Monster' status is because the MovieClip object does not behave like any other OO Class and due to it being at the core of Flash, and ActionScript Programming , I would imagine that it has caused it's share of headaches to more people than just me. Don't get me wrong, I am a hardcore ActionScript programmer, I've hung in there by a thread, and now that ActionScript 3.0 has finally arrived with Flash CS3, I can breath a sigh of relif. OO ActionScript has finally arrived, and none too late! There is a lot of power in Extending MovieClip . It gives your clip clout, demanding respect from all of the lesser MovieClips on the stage. It also offers the developer more flexibility, and opens up a world of potential for your next ActionScript Flash Application. With this power and respect, comes the weight of responsibility. I hereby take responsibility to share with you all of the lessons that I've learned about this subject so that you will know what to watch out for as you grow your own skill set. I hope that you will gain encouragement and momentum from this knowledge, and I wish you a journey full of epiphanies, as you develop your ActionScript Programming skills going forward. My Lessons LearnedThe biggest challenge with Extending MovieClip , is that it does not use it's constructor to instantiate, as other classes are wont to do. Here are my lessons learned listed for you in the hopes that they save you some stress as you develop your ActionScript Programming skills.
Rules For Constructing a SubClass of MovieClip:
Tools and ResourcesYou will find the working demonstration of the code I've discussed at the beginning of this article. I have put together a zipped up source code file help clarify the concept for anyone who may need it. You can find it at Flash.Tips-for-You.com . Upon reviewing the demonstration source code, you will find:
-Tyler An epiphany is the sudden realization or comprehension of the (larger)
essence or meaning of something. The term is used in either a
philosophical or literal sense to signify that the claimant has "found
the last piece of the puzzle and now sees the whole picture," or has
new information or experience, often insignificant by itself, that
illuminates a deeper or numinous foundational frame of reference.
|