Please note that ExpatTech is close for the Christmas and New Year holidays. We will re-open on 2nd January 2024.

ExpatTech Techblog

Peter Todd 2009.08.31. 11:40

Flash Cookbook - Appendix - practical tips for Adobe Flash

There is a practical usage of classes in Adobe Flash developing environment. Create a movieclip and design all the visual parts of it. Let's say you want to build an mp3 player. Just simply put on all the buttons and scrollbars, textfields needed in the player and then...

in the library rightclick on the symbol, then Properties. Click "Export for Actionscript". You will need to fill out two boxes:

Class - give a name for this object

Base class - create an external as class and type it's path and name (for example myclasses/MP3Player.as will be myclasses.MP3Player)

In your external class file define all the necessary variables and functions and there you go, the magic is done. In your class - the base class - anything what you link "this" will belong to the movieclip. Let's say your moveiclip has a button called playButton, then simply give it a listener in this class file: playButton.addEventListener(...).

Fast, clean and wonderful.