Posted By

allnatural on 01/22/10


Tagged

json


Versions (?)

JSON -> Flash


 / Published in: ActionScript 3
 

URL: http://www.destroyyourcomputer.com

  1. //actionscript 3
  2. import flash.net.URLRequest;
  3. import flash.net.URLLoader;
  4. import com.adobe.serialization.json.JSON;
  5.  
  6. var loader:URLLoader = new URLLoader();
  7. loader.load(new URLRequest("http://localhost/flash/person.php"));
  8. loader.addEventListener(Event.COMPLETE, onComplete_handler);
  9.  
  10. function onComplete_handler(event:Event) {
  11. var person:Object=JSON.decode(event.target.data);
  12. trace(person[0].firstname + " " + person[0].lastname);
  13. trace(person[1].firstname +" " +person[1].lastname);
  14. }

Report this snippet  

You need to login to post a comment.