jan_flanders

Untitled

Jan 6th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Error : Invalid class name Application.Server
  2.  
  3. //build.hxml :
  4. /*
  5. -main Application.Server
  6. -php bin
  7.  
  8. --next
  9. -main  Application.Client
  10. -swf bin/client.swf
  11. */
  12.  
  13. //Application.hx :
  14. #if php
  15. class Server
  16. {  
  17.     public static function main()
  18.     {
  19.         var params = php.Web.getParams();
  20.         var name = params.get("name");
  21.         var age = params.get("age");
  22.         php.Lib.print("result=Your name is " + name +" and your age is " + age);
  23.     }
  24. }
  25. #elseif flash
  26. class Client extends flash.display.Sprite
  27. {
  28.     public function new()
  29.     {
  30.         super();
  31.        
  32.         var urlVariables = new flash.net.URLVariables();
  33.         urlVariables.name = "jan";
  34.         urlVariables.age = 21;
  35.        
  36.         var urlRequest = new flash.net.URLRequest("server.php");
  37.         urlRequest.data = urlVariables;
  38.        
  39.         var urlLoader = new flash.net.URLLoader();
  40.         urlLoader.dataFormat = flash.net.URLLoaderDataFormat.VARIABLES;
  41.         urlLoader.addEventListener(flash.events.Event.COMPLETE, onLoadComplete);
  42.         urlLoader.load(urlRequest);
  43.     }
  44.     function onLoadComplete(event:flash.events.Event)
  45.     {
  46.         var result = event.currentTarget.data.result;
  47.         trace(result);
  48.        
  49.     }
  50.     public static function main()
  51.     {
  52.         flash.Lib.current.addChild(new Client());
  53.     }
  54. }
  55. #end
Advertisement
Add Comment
Please, Sign In to add comment