How do you clear this error with using HaxePunk in FlashDevelop?

658 views Asked by At

I have tried researching this and using pre-made templates, but to no avail. I just want to get a real basic HaxePunk project working with FlashDevelop, with making Flash games in mind. Going back to real basic tutorials and such, this is my code:

import com.haxepunk.Engine;
import com.haxepunk.HXP;

class Main extends Engine
{

    /*override public function init()
    {
#if debug
        HXP.console.enable();
#end
        //HXP.scene = new MainScene();
    }*/

    public static function main() { new Main(); }

}

I'm not sure whether to compile this as a Flash Player project or an NME project (I'm really new to this). If I try to compile it as a Flash Player project, I get this error at runtime:

TypeError: Error #2007: Parameter type must be non-null.
    at flash.events::EventDispatcher/addEventListener()
    at flash.display::Stage/addEventListener()
    at com.haxepunk.utils::Input$/enable()
    at com.haxepunk::Engine/onStage()
    at com.haxepunk::Engine()
    at Main()
    at Main$/main()
    at boot_0b9a/init()
    at flash::Boot/start()
    at boot_0b9a()

If I try to compile it as an NME project, I get this error at compile time:

Error: You must have a "project.xml" file or specify another valid project file
when using the 'build' command

I'm not finding a whole lot of information about this. What would likely be wrong here? Thanks.

1

There are 1 answers

0
npretto On BEST ANSWER

You have to make an OpenFL project, not a flash one, this is because HaxePunk uses OpenFL for rendering.

To get flashdevelop work with an HaxePunk project this is what I usually do:

  1. Create a new blank openfl project in FlashDevelop
  2. Create a haxepunk project the commandline (it should be 'haxepunk new name')
  3. Substitute files from the haxepunk project into the flashdevelop one
  4. "Fix what's wrong"

Number 4 is usually a matter of renaming files, iirc in the haxepunk project files has a different name from the one in the flashdevelop one so you'll have to change it