0

平台目标: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)
4

1 回答 1

0

尝试:

 import nme.Lib;

 public function new() 
 {
    super();

    sx = Lib.current.stage.stageWidth;
    sy = Lib.current.stage.stageHeight;
 }
于 2013-05-12T08:28:22.850 回答