简体   繁体   English

如何在FlashDevelop中使用HaxePunk清除此错误?

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

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. 我只想获得一个真正的基本的HaxePunk项目,该项目可以与FlashDevelop一起使用,并且牢记Flash游戏。 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). 我不确定是将其编译为Flash Player项目还是NME项目(对此我真的很陌生)。 If I try to compile it as a Flash Player project, I get this error at runtime: 如果尝试将其编译为Flash Player项目,则在运行时会收到此错误:

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: 如果我尝试将其编译为NME项目,则在编译时会收到此错误:

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. 谢谢。

You have to make an OpenFL project, not a flash one, this is because HaxePunk uses OpenFL for rendering. 您必须创建一个OpenFL项目,而不是Flash项目,这是因为HaxePunk使用OpenFL进行渲染。

To get flashdevelop work with an HaxePunk project this is what I usually do: 为了使Flashdevelop与HaxePunk项目一起工作,这通常是我要做的:

  1. Create a new blank openfl project in FlashDevelop 在FlashDevelop中创建一个新的空白openfl项目
  2. Create a haxepunk project the commandline (it should be 'haxepunk new name') 在命令行中创建一个haxepunk项目(应为“ haxepunk新名称”)
  3. Substitute files from the haxepunk project into the flashdevelop one 将文件从haxepunk项目替换为flashdevelop
  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 数字4通常是重命名文件的问题,haxepunk项目文件中的iirc与flashdevelop中的名称不同,因此您必须对其进行更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM