Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Error : Invalid class name Application.Server
- //build.hxml :
- /*
- -main Application.Server
- -php bin
- --next
- -main Application.Client
- -swf bin/client.swf
- */
- //Application.hx :
- #if php
- class Server
- {
- public static function main()
- {
- var params = php.Web.getParams();
- var name = params.get("name");
- var age = params.get("age");
- php.Lib.print("result=Your name is " + name +" and your age is " + age);
- }
- }
- #elseif flash
- class Client extends flash.display.Sprite
- {
- public function new()
- {
- super();
- var urlVariables = new flash.net.URLVariables();
- urlVariables.name = "jan";
- urlVariables.age = 21;
- var urlRequest = new flash.net.URLRequest("server.php");
- urlRequest.data = urlVariables;
- var urlLoader = new flash.net.URLLoader();
- urlLoader.dataFormat = flash.net.URLLoaderDataFormat.VARIABLES;
- urlLoader.addEventListener(flash.events.Event.COMPLETE, onLoadComplete);
- urlLoader.load(urlRequest);
- }
- function onLoadComplete(event:flash.events.Event)
- {
- var result = event.currentTarget.data.result;
- trace(result);
- }
- public static function main()
- {
- flash.Lib.current.addChild(new Client());
- }
- }
- #end
Advertisement
Add Comment
Please, Sign In to add comment