Creating sound constants
Now we're going to create a class that will contain constants for all of the music and the id
attributes of sound we defined in the project file. We'll also create constants for our music and sound volume settings.
Creating the class
First, in the source
folder, make a new folder named audio
. Inside that folder, make a new class named Sounds
. This class doesn't extend any other classes and doesn't need to import anything.
Here's what it should look like to start:
package audio; class Sounds { }
Creating sound ID constants
Now let's add variables for each ID that we defined in the project file:
public static inline var MUSIC_FANFARE:String = "music_fanfare"; public static inline var MUSIC_INGAME:String = "music_ingame"; public static inline var SOUND_WHOOSH:String = "sound_whoosh"; public static inline var SOUND_TING:String = "sound_ting"; public static inline var SOUND_CLICK:String = "sound_click...