Game Development Reference
In-Depth Information
override public function systemLevelIn():void {
levelInScreen.alpha = 1;
super.systemLevelIn();
}
override public function systemWait():void {
//trace("system Level In");
if (lastSystemState == FrameWorkStates.STATE_SYSTEM_LEVEL_IN) {
levelInScreen.alpha -= .01;
if (levelInScreen.alpha < 0 ) {
dispatchEvent(new Event(EVENT_WAIT_COMPLETE));
levelInScreen.alpha = 0;
}
}
}
}
}
Creating the Library.as class for Flex SDK only
Now, just add in the three sounds we will need. There are two music loops and a single sound
effect for when the player's ship hits an obstacle. You will not need this class if you are using the
Flash IDE.
package com.efg.games.tunnelpanic
{
public class Library {
[Embed(source = '../../../../../assets/startmusic.mp3')]
public static const SoundMusicInGame:Class;
[Embed(source = '../../../../../assets/ingamemusic.mp3')]
public static const SoundMusicTitle:Class;
[Embed(source='../../../../../assets/explode.mp3')]
public static const SoundExplode:Class;
}
}
Adding to the Flash IDE Library
The previous section in the chapter on preloading has covered adding these same assets to the
library and then placing them in an assets clip for preloading. If you have not read that section,
you should go back and do so now.
Note: In Main.as you only need to addSounds function if you are using the Flash IDE. If you are
using the IDE, be sure to comment out the soundManager.addSound function calls in the init
function.
Search WWH ::




Custom Search