Return to Snippet

Revision: 8778
at October 7, 2008 10:21 by Paco


Updated Code
/* LoadVars load example */
// init LoadVars Object
lv = new LoadVars();

// define onLoad Callback
lv.onLoad = onLoadCallBack;

// send and load variables
lv.load("http://localhost:2400/lv.txt?" + new Date());

// onLoad Callback
function onLoadCallBack(succes)
{
    // if succes
    if(succes)
    {
        // trace variables
        trace(this.lVar1);
        trace(this.lVar2);
    }
    else
    {
        // loading failed
        trace("Loading Error!!");
    }
}

/*LoadVars send example*/
// init LoadVars Object
lv = new LoadVars();

// set Variables
lv.sVar1 = "value1";
lv.sVar2 = "value2";

// define onLoad Callback
lv.onLoad = onLoadCallBack;

// send and load variables
lv.sendAndLoad("http://localhost:2400/lv.php?" + new Date(), lv, "POST");

// onLoad Callback
function onLoadCallBack(succes)
{
    // if succes
    if(succes)
    {
        // trace variables
        trace(this.lVar1);
        trace(this.lVar2);
    }
    else
    {
        // loading failed
        trace("Loading Error!!");
    }
}

/* PHP code */
<?
    // get variables
    $var1 = $_POST['sVar1'];
    $var2 = $_POST['sVar2'];
    
    // send variables
    echo "&lVar1=$var1 returned&";
    echo "&lVar2=$var2 returned as well&";
?>

Revision: 8777
at October 7, 2008 10:12 by Paco


Initial Code
/* LoadVars load example */
// init LoadVars Object
lv = new LoadVars();

// define onLoad Callback
lv.onLoad = onLoadCallBack;

// send and load variables
lv.load("http://localhost:2400/lv.txt?" + new Date());

// onLoad Callback
function onLoadCallBack(succes)
{
    // if succes
    if(succes)
    {
        // trace variables
        trace(this.lVar1);
        trace(this.lVar2);
    }
    else
    {
        // loading failed
        trace("Loading Error!!");
    }
}

/*PHP variabel text : */
//       &lVar1=this is var1&lVar2=this is var2&

/*LoadVars send example
// init LoadVars Object
lv = new LoadVars();

// set Variables
lv.sVar1 = "value1";
lv.sVar2 = "value2";

// define onLoad Callback
lv.onLoad = onLoadCallBack;

// send and load variables
lv.sendAndLoad("http://localhost:2400/lv.php?" + new Date(), lv, "POST");

// onLoad Callback
function onLoadCallBack(succes)
{
    // if succes
    if(succes)
    {
        // trace variables
        trace(this.lVar1);
        trace(this.lVar2);
    }
    else
    {
        // loading failed
        trace("Loading Error!!");
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
AS2 LoadVars PHP example

Initial Tags
php

Initial Language
ActionScript