Reputation: 21
I keep getting an error where it's expecting a } in the "case 'captain-cool'" I don't know what it means and adding a } gives me the same error.
swith(curSong.toLowerCase());
{
case 'captain-cool':
{
trace('matthewanimation')
inCutscene = true;
var matthewMicGrab:FlxSprite = new FlxSprite();
var micsound:FlxSound = new FlxSound().loadEmbedded('assets/week1/sounds/micsound.ogg')
var armmove:FlxSound = new FlxSound().loadEmbedded('assets/week1/sounds/armmove.ogg')
matthewMicGrab.frames = Paths.getSparrowAtlas('assets/week1/images/cutsceneshit/matthewMic.png','assets/week1/images/cutsceneshit/matthewMic.xml');
matthewMicGrab.animation.addByPrefix('micgrab', 'Matthew MIC', 24, false);
animation.antialiasing = true;
add(animation);
Upvotes: 2
Views: 719
Reputation: 227
You don't need braces after a case
statement, and switch
is not a function.
This is a demonstration of the correct syntax:
switch (curSong.toLowerCase()) {
case 'captain-cool':
trace('matthewanimation');
case 'something-else':
doStuff();
default:
doDefaultThings();
}
Upvotes: 1