user2372658
user2372658

Reputation: 1

stageWidth&height in neko

platform target:NME-Neko

Hi I need stage's Width, so I call stage.stageWidth like this:

public function new() 
{
    super();

    sx = stage.stageWidth;
    sy = stage.stageHeight;
}

but It traced Error:

プロセスを実行中: 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)

Upvotes: 0

Views: 156

Answers (1)

Allan
Allan

Reputation: 3314

Try:

 import nme.Lib;

 public function new() 
 {
    super();

    sx = Lib.current.stage.stageWidth;
    sy = Lib.current.stage.stageHeight;
 }

Upvotes: 0

Related Questions