Tutorials Create own backend
From HippoHX
If your application needs to do something that is completely outside of or cannot be achieved through the official API, you can add you own backend methods. That means creating your own haXe/Neko functions and call them from your Flash application. You need 2 steps:
On the backend:
- Create an hx class and extend HippoHX's main class App.hx. This will include HippoHX's API and still let you add your own methods.
- Create your functions using haXe or Neko calls. Please note that your methods must be public if you are compiling to player 9 or above due to AVM2 runtime checking of the public/private modifiers.
- Register your class to expose your public methods so they can be called from the client:
private function registerBackends():Void{
context.addObject("myCustomBackend",this);
}
- Compile to myapp.n
On the client:
- From a Flash application you can call your backend method using the Api class:
import com.hippohx.Api;
...
Api.call("myCustomBackend.myCustomMethod",param1,param2);
Finally you can pack your application using the GUI or the packager but you must define your own .n file so it gets bundled instead of the common HippoHX app.n file.
You can see a complete working sample in the demo folder or take a look at the GUI code.

