gateway class will simply be a new class that serves as a communication gateway between the
ControlBar and the
MediaPlayer. To start with, we will create a new file called
MediaGateway.as and open up that file within our Flash IDE. One major difference between this class and the other classes we have implemented in this book is that this gateway should be declared and used statically.
A static function is a special type of function, within a class, which can be called without the requirement for an instantiated object. What this means is that any object can access each function declared within our
MediaGateway class by calling the function directly, instead of calling through a declared object. For example, if we wish to use the
MediaPlayer class to play a media track, we must first declare a
MediaPlayer object and then load that media file by calling a non-static function on that media object as follows:
var media:MediaPlayer = new...