Author Topic: SwitchState don't work  (Read 613 times)

thedupy124

  • New Member
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
SwitchState don't work
« on: Wed, Jul 13, 2016 »
Hello everyone.

I'm a beginner with Flixel, so i try to make a pong to learn this beautiful librarie. I need to make a victory screen that will ask if the player want to start again. So, i made a VictoryState class, and in this class, I use FlxG.switchState(new PlayState()) to switch on the game, but i got the error :
"Call to a possibly undefined method switchState through a reference with static type Class."

And I just don't understand why i got this error. I try to do it in another static function, but i got the same error.

Code: [Select]
package com
{
import org.flixel.*;
/**
* ...
* @author Dupy
*/
public class VictoryState extends FlxState
{
private var again:FlxText;

public function VictoryState()
{
again.text = "LOL";
}

override public function update():void
{
if (FlxG.keys.X)
{
                                FlxG.switchState(new PlayState());
}
}

}

}

Help me please, dear community !