Game Development Reference
In-Depth Information
* Plays the sound specified by the name parameter. Checks for the
sound internally first, and then looks for it as an external file.
* @param name String The name of the linked Sound in the
library, or the URL reference to an external sound.
* @param
offset Number
The number of seconds offset the
sound should start.
* @param loops int The number of times the sound should
loop. Use -1 for infinite looping.
* @param
The initial sound transform
to use for the sound.
* @return SoundChannel The SoundChannel object created by
playing the sound. Can also be retrieved through getChannel
public function playSound(name:String, offset:Number = 0, loops:
int = 0, transform:SoundTransform = null):SoundChannel
Note that the comment block is placed just before the method
itself. It starts with a description of the method and then a list of
parameters it accepts and what it returns. When using an editor
like FlashDevelop or compiling documentation, the method itself
will be used to define things such as the default values of
parameters and specific data types.
The Bottom Line
It is better to comment some than none at all, so even if you
pressed for time, you
ll thank yourself later for having put some-
thing in, even if later on it takes you a minute to remember what
you were thinking.
Part 6: Why Does Flash Do That?
Flash and ActionScript have a number of idiosyncrasies that can
throw even seasoned developers off track. Some of these oddities
are instances where the language breaks form with similarly
constructed languages like Java or C#, much to the chagrin of devel-
opers coming to Flash from these languages. Others have to do with
the processing order in which Flash performs commands; some-
times, a bug is simply the result of a misunderstanding of this
of operations.
ll cover a number of these quirks in this section.
Event Flow
One of the common misunderstandings that I
ve witnessed with
developers first utilizing Flash
s event model is the difference
Search Nedrilad ::

Custom Search