平台目标:NME-Neko
嗨我需要舞台的宽度,所以我这样调用stage.stageWidth:
public function new()
{
super();
sx = stage.stageWidth;
sy = stage.stageHeight;
}
但它跟踪错误:
プロセスを実行中: C:\Motion-Twin\haxe\haxelib.exe run nme run "C:\Users\osibsam\Google 드라이브\3DBG\application.nmml" neko
Called from ? line 1
Called from ApplicationMain.hx line 39
Called from nme/Lib.hx line 77
Called from native/Lib.hx line 74
Called from native/Lib.hx line 88
Called from ApplicationMain.hx line 64
Called from C:\Motion-Twin\haxe/std/neko/_std/Type.hx line 103
Called from osibsam/Main.hx line 18
Called from osibsam/Main.hx line 30
Uncaught exception - Invalid field access : get_stageWidth
Done(1)
答案 0 :(得分:0)
尝试:
import nme.Lib;
public function new()
{
super();
sx = Lib.current.stage.stageWidth;
sy = Lib.current.stage.stageHeight;
}