haxehaxeflixel

HaxeFlixel... type not found : flixel.FlxGame


package;

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.Lib;
import flixel.FlxGame;
import flixel.FlxState;

/**
 * ...
 * @author Jacob
 */ 
class Main extends Sprite 
{
    var gameWidth:Int = 800;
    var gameHeight:Int = 480;
    var initialState:Class<FlxState> = PlayState;
    var zoom:Float = -1;
    var Framerate:Int = 60;
    var skipSplash:Bool = false;
    var startFullscreen:Bool = false;

    public function new() 
    {
        super();        
    }
}

Some preliminary stuff, just in case...

Windows 10 I have all of the dependencies and haxeflixel installed with haxelib I'm using the latest version of Haxe, downloaded and installed yesterday. I'm programming in FlashDevelop.

import flixel.FlxGame 

...gets underlined in red, and I get the error

type not found : flixel.FlxGame

...at compile, I've had a single case where simply retyping that (without any kind of change in what was typed, no typos corrected) fixed the problem, but I have not been able to replicate. I have this project compiled, just not the latest one, this error cropped up out of nowhere and has prevented me from getting any farther.

I've had the same problem in my PlayState with import flixel.FlxObject as well.

What is going on here? I have compiled the FlxSnake example among other things, so I don't believe that it's an issue with my installation, but I can't imagine what could be wrong with an import.

Edit: I didn't follow the standard architecture for a flixel project, intending to try for a minimalist, single file practice project initially.


Solution

  • How did you create the project? Project -> New Project in FlashDevelop? Provided you chose the correct project type ("OpenFL"), there should be a project.xml configuration file which is used for compilation (some docs on the format can be found here). That file has to include the flixel library via <haxelib name="flixel" />.

    However, there's not really much of a reason to do all this manually. It's recommended to use flixel-tools to create projects from an existing template. Alternatively, there's a FlashDevelop template available here ("FlashDevelop .fdz template").

    You can pretty much ignore the .hxproj file, that's a FlashDevelop Haxe project file and not intended to be edited manually.