FlashDevelop/OpenFL: How to set default target to neko

半世苍凉 提交于 2019-12-23 03:52:20

问题


I am trying to write some cross-language code with Haxe/OpenFL and compile it using FalshDevelop. But I get an error as soon as I use the basic Sys.print function. A minimal example is as follows:

package;

import flash.display.Sprite;

class Graphic extends Sprite {


    public function new () {
        super ();
    }

    static function main() { //used in standalone swf project
        Sys.print("Hi");
        }
}

It turns out that the default compile command of FlashDevelop is something like:

haxelib run openfl build project.xml flash

,which gives an error on Sys.print:

Graphic.hx:xx: characters 2-11 : Accessing this field requires a system platform
 (php,neko,cpp,etc.)

My guess is that Sys.print isn't available in the flash target or flash isn't a system platform (strange). I was wondering if there is way to work around this, and configure FlashDevelop so that the compile command is:

haxelib run openfl build project.xml neko

Thanks


回答1:


There are actually 2 questions.

For the first one, Sys.print is available only on some platforms because it wouldn't make sense in others(what would it do in flash?), what you probably want is trace, which is used to print things for debug purposes.

For the second question there is a drop down menu at the top of flashdevelop if you created a openfl project that looks like this and does exactly that:



来源:https://stackoverflow.com/questions/21958818/flashdevelop-openfl-how-to-set-default-target-to-neko

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!