load variables from php file


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import flash.events.MouseEvent;
  2. import flash.net.URLLoader;
  3. import flash.net.URLRequest;
  4. import flash.net.URLLoaderDataFormat;
  5. import flash.events.Event;
  6.  
  7. btn.addEventListener(MouseEvent.CLICK, klik);
  8. function klik(e:MouseEvent):void{
  9. var req:URLRequest = new URLRequest("check.php");
  10. var loader:URLLoader = new URLLoader(req);
  11. loader.dataFormat = URLLoaderDataFormat.VARIABLES;
  12. loader.addEventListener(Event.COMPLETE, komplet);
  13. }
  14.  
  15. function komplet(e:Event):void{
  16. infoTXT.text = e.target.data.vyhra + " - " + e.target.data.id;
  17. }
  18.  
  19.  
  20. // PHP :: check.php
  21. <?php
  22. echo "vyhra=true&id=123456";
  23. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.