loadvars sendAndLoad custom use


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

Used to make server-side communication easier


Copy this code and paste it in your HTML
  1. serverGateway('updateRecentlyViewedMedia');
  2.  
  3. function serverGateway(strGatewayMethod)
  4. {
  5. switch(strGatewayMethod)
  6. {
  7. case "updateRecentlyViewedMedia"
  8. updateRecentlyViewedMedia_sender = new LoadVars();
  9.  
  10. //vars
  11. updateRecentlyViewedMedia_sender.gatewayMethod = gatewayMethod;//used to tell flash_gateway.php
  12. updateRecentlyViewedMedia_sender.sendAndLoad(_root.domainPrefix + "flash_gateway.php", updateRecentlyViewedMedia_loader, "POST");
  13. break;
  14. }
  15. }
  16.  
  17. var updateRecentlyViewedMedia_loader = new LoadVars();//method for retrieving vars from server file
  18. updateRecentlyViewedMedia_loader.onLoad = function(success)
  19. {
  20. if(success)
  21. {
  22. _root.videoDomain = this.videoDomain;
  23. }
  24. else
  25. {
  26. trace("did not load");
  27. }
  28. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.