Prev | Current Page 797 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The client accesses the
server code using the cnx instance.
// content of the file Client.hx
class Client
{
public static function main()
{
var cnx = haxe.remoting.Connection.jsConnect();
try
{
trace(cnx.Calc.sum.call([5,4]));
} catch(e : Dynamic) {
trace(Std.string(e));
}
}
}
Both scripts can be compiled at once saving the following text in a file build.hxml . Note that two client
flash movies are created for both Flash 8 and 9.
-main Client
-swf out/client8.swf
-swf-header 320:40:20:ffffff
-swf-version 8
--next
-main Client
-swf out/client9.swf
-swf-header 320:40:20:ffffff
-swf-version 9
--next
Server
-js out/server.js
The compiled files can be produced executing the following command from the command line/console.
Make sure you have created the out directory before the command execution.
> haxe build.hxml
You can finally produce an HTML page to host the example.
< html >
< head > < title > Flash-to-JS < /title > < /head >
< script type=???text/javascript??? src=???swfobject.


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