Prev | Current Page 796 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The code works just fine in Flash or
JavaScript when they are used as server in a local connection. The server code is compiled declaring just
a class Calc with a single static method sum whose purpose is obvious.
// content of the file Server.hx
import haxe.remoting.Connection;
class Calc
{
public static function sum(x : Int, y : Int) : Int
{
return x + y;
}
}
Table 15-3
Connection Creational Method Description
jsConnect(?name:String) Used in a Flash movie to connect to a JavaScript host. The
optional name parameter is used to direct the connection method
invocations to a specific JavaScript object registered on the server
using the bind static method.
flashConnect(objId:String) Creates a connection to a Flash movie when the client is
JavaScript. The argument is the id attribute of the HTML element
that embeds the Flash Movie.
urlConnect(url:String) Can be used in JavaScript or Neko to connect to a Neko HTTP
server using a standard HTTP connection.
Part II: Server Side, JavaScript, and Flash: Oh My!
430
If the client is Flash, the code to access the JavaScript server can be the following.


Pages:
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808