O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Initializing the client connection

The first thing we need to do is to initialize our connection. We will store it in a static variable, as follows:

class ZooCommander
{
public static var cnx : haxe.remoting.Connection;
public static function main()
{
//Create the connection
cnx = haxe.remoting.HttpConnection.urlConnect ("http://localhost:8888/ZooKeeper.phpdir/index.php");
}
}

What just happened?

We have simply created a connection over HTTP to our server by passing its address as the parameter.

Now, let's create our two functions.

The createAnimal function

We will create a createAnimal function, which will be called by the main menu when the user chooses to add an animal to the list.

It will first ask for the required information and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required