• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 17. Sending and Receiving Data > LoadVars.sendAndLoad()

LoadVars.sendAndLoad()

To both send and receive data, you need two LoadVars objects: one that holds the data you want to send, and the other to receive all the data you expect to get.

var classID_lv:LoadVars = new LoadVars();
var isFull_lv:LoadVars = new LoadVars();

// in the real world, this value would come from somewhere else,
// like a list the user chose from
classID_lv.classid = 14;

class_btn.onRelease = function ()
{
    _root.createTextField("isFull_txt", 1, 20, 20, 200, 30);
    isFull_txt.text = "loading...";
    classID_lv.sendAndLoad("classFull.php3",isFull_lv, "POST");
}

isFull_lv.onLoad = function()
{

    if (isFull_lv.isFull)
    {
          isFull_txt.text = "Full";
    }
    else
    {
          isFull_txt.text = "Room available."
    }
}
// Ideally, of course, you'd want to provide more information,
// like how many spots are still open, or how many people are
// on the waiting list, but that's a little much for this example.


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint