We Recommend

The Art of Prolog, Second Edition: Advanced Programming Techniques The Art of Prolog, Second Edition: Advanced Programming Techniques
This new edition of The Art of Prolog contains a number of important changes. Most background sections at the end of each chapter have been updated to take account of important recent research results, the references have been greatly expanded, and more advanced exercises have been added which have been used successfully in teaching the course.


Posted By

daisuke103 on 02/11/08


Tagged

php textmate send load as2 sendAndLoad CASA varsload


Versions (?)


AS2 CASA PHPとやりとりする


Published in: Other 


  1. /* ここから */
  2. /*
  3. new VarsLoad()の第1引数でPHPのパスを指定し、第2引数で「GET」か「POST」の送信方法を指定する。 myVarsLoad.setValue("text", "Hello World");でPHPに渡したい値を指定する。第1引数が変数名で第2引数が値になる。
  4. PHPからの返り値を受け取るにはコンプリートハンドラーの中でthis.myVarsLoad.getValue("text")とすればよい。この場合の引数はPHPから返ってくる変数名を指定する。ちなみにPHPからの返り値を全て見たいときはtrace(this.myVarsLoad.$ receive)とすればよい。
  5. PHPから返ってくるオブジェクトそのものを見たいときはObjectDumper.toString()メソッドを使うと一発で理解できる。trace(ObjectDumper.toString(myVarsLoad, true, true));とすれば中身が丸見え。
  6. */
  7. import org.casaframework.load.data.VarsLoad;
  8.  
  9. //-----[初期設定]
  10. var myVarsLoad:VarsLoad;
  11.  
  12. //-----[ボタンクリックでPHPと通信]
  13. btn.onRelease = function()
  14. {
  15. myVarsLoad = new VarsLoad("やりとりしたいPHPのパス", "GET");
  16. myVarsLoad.addEventObserver(_root, VarsLoad.EVENT_LOAD_COMPLETE, "onDataLoad");
  17. myVarsLoad.setValue("text", "Hello World");
  18. myVarsLoad.start();
  19. }
  20.  
  21. //-----[ロード完了]
  22. function onDataLoad(sender:VarsLoad):Void
  23. {
  24. trace(this.myVarsLoad.getValue("text"));
  25. }

Report this snippet 

You need to login to post a comment.