Documentation/Programming Articles/Web Player Deployment: JavaScript Calls

From NeoAxis Engine Wiki

Jump to: navigation, search
Go to higher level


The html page that contains NeoAxis Web Player content can communicate with content via JavaScript calls.

Supported calls JavaScript functions from game code. Return back results are supported too.


Next types are supported:

  • Simple types: bool, sbyte, byte, char, short, ushort, int, float, double.
  • Strings

All other values will converted to string via ToString() method.


Prepare html page

Add on html page next code:

<script language="javascript" type="text/javascript">
<!--
  function testFunction(arg1)
  {
     alert(arg1);
  }
  -->
</script>


Call from game code

Calls with one argument:

object result;
EngineApp.Instance.WebPlayerBridge.CallFunction( "testFunction", out result, "argument1Value" );

Calls with several arguments of different types:

object result;
EngineApp.Instance.WebPlayerBridge.CallFunction( "testFunction2", out result, "argument1Value", 5.0f, 4 );