Re: Calling Haxe function from native Extension

Hi, I think you are right, you need something like getMainView. It may also be worth adding some sugar, to make it a bit more obvious what you are supposed to do: static void GameActivity.runOnHaxeThread(Runnable inRunnable); ie: onClick(Dialog…

Viewing 1 to 1 (1 Total)
Re: Calling Haxe function from native Extension

Huge

Huge
Total Posts: 546
Joined: October 07, 2011

Hi,
I think you are right, you need something like getMainView.

It may also be worth adding some sugar, to make it a bit more obvious what you are supposed to do:

static void GameActivity.runOnHaxeThread(Runnable inRunnable);

ie:
onClick(DialogInterface dialog, int id) {
GameActivity.runOnHaxeThread(new Runnable(){ public void run() {
if (eventHandle != null)
eventHandle.call0("someFunction");
} } );

You could even add a few more overloads to wrap the Runnable call:
static void GameActivity.runOnHaxeThread(HaxeObject callback, String funcName);
static void GameActivity.runOnHaxeThread(HaxeObject callback, String funcName, Value arg0); ....

to allow:
onClick(DialogInterface dialog, int id) { GameActivity.runOnHaxeThread(_eventHandle,"onClick",id); }


Hugh

Posted on June 25, 2012 at 11:46 PM