Send variables from flash to PHP

Hello world
I have a problem when sending variables from flash to PHP
Here is the code:

submit.onPress = function)
{
c = new LoadVars ();
c.NME = "Myname"
c.sendAndLoad ("getVars.php", reply, 'POST');
}

PHP code:

<? PHP
$name = $_POST ['nme'];
Print 'your name is. " $name. «. < br / > ';
? >

What I'm doing wrong here.
I get an error message saying notice: Undefined index: name in \xxx\getVars.php on line 2

Please help me. Thanks in advance

2 things that I notice immediately

1. you never initialize the variable 'Reply' to your sendAndLoad.
2. you must pass a string encoded in URL variables which is ampersand delimited. Usually the returned string would look like echo ("" & result = 1 & msg = your % 20name % 20is %20 '. ") $name. ». 3rd % 3Cbr % &");

Your mistake is that the information is not get passed correctly. I usually use $_REQUEST communication flash-php, although this should not make a difference. I've seen people use $_REQUEST for testing purposes and will then to $_POST when finished.

Tags: Adobe Animate

Similar Questions

  • Send variables from flash AS2 to php mySQL

    Hi I have a question to adobe. So I finally created a system to connect / register with php and mysql and flash as2. That works, and here's the link:lumosityentertainment.hostei.com/PhPLoginSystem.swf

    But I have a question. How to send variables from flash as2 to my mySQL database? And then how to load their MySQL to flash as2? Also when variables get edited or changed as if I had 6 gold and then now I have 7 but how do send flash that updated data in my database? I know you use php and other things but I have examples of easy php and codes as2? I'm a beginner in php, but I know a decent amount of AS2. I searched all over google and adobe for the answer forums, but none of them really helped. I am currently working on a flash game on my site and I'm doing so that players can save as their gold, armor, weapons etc and then load them by logging into their account.  Here is my game that I currently use cookies to save the data:

    lumosityentertainment.enjin.com/playfantasydreams

    var sendLV:LoadVars = new LoadVars();

    var receiveLV:LoadVars = new LoadVars();

    receiveLV.onData = function(src:String) {}

    trace (SRC);  or be it for debugging

    }

    sendLV.somedata = somedata;

    sendLV.someotherdata = someotherdata;

    sendLV.sendAndLoad ("yourphp.php", receiveLV, "POST");

    /////////////////////////////////

    ////

    PHP

    .

    .

    $somedata = $_POST ['somedata'];

    $someotherdata = $_POST ['someotherdata'];

    write to your sql

    {if (whatever)}

    echo "success";

    } else {}

    echo "failed."

    }

    /////////////////////////////////

    PS when you use the adobe forums, please check the useful/correct, if there is.

  • Passing variables from flash to php script - does not!

    Hey everybody. I was wondering if someone could help me. I use as2 to pass a variable from flash to my php and nothing happened! Here's the action script code that I put on my button:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = amount.text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    The amount of '5' is now in a dynamic text field with the variable name and instance of amount (which, in the future, will be hidden). This works very well when the button is clicked. What I'm trying to do without success, is to get this value of '5' to my test.php and did echo and it happens simply not . It comes to my php script:

    <? PHP

    $form_inp = $_POST ["amount"];

    If ($form_inp == "'")

    {

    Print "nothing entered < br >".

    }

    on the other

    {

    Print "you entered: $form_inp";

    }

    ? >

    I'm getting "Nothing entered" every time.

    I've tried different ways for the amount.text such as:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = this. Amount.Text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    and

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = this ._parent. Amount.Text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    etc...

    I also tried to change the variable name in the function sendAndLoad amount to form1 as follows:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = amount.text;

    form1.sendAndLoad ("http://mywebpage.com/test.php",form1, "POST");

    }

    and still nothing.

    In my php file, I even tried the GET instead of the POST and it always turns out nothing.

    <? PHP

    $form_inp = $_GET['monto"];

    If ($form_inp == ")

    {

    Print "nothing entered < br >".

    }

    on the other

    {

    Print "you entered: $form_inp";

    }

    ? >

    Additional info:  I put the .swf file and at the same level-.php file in the same folder on my server just to be safe, and the dynamic amount.text text field and button are at the same level in the .swf file.

    Anyone can shed some light on my situation... pretty please? I'm out!

    Thank you very much.

    Ok. So, do not let this thread unanswered, after a looooooong of trial and error, I went to as3 and began to do some testing. It turned out that the register_globals was off on my site and that is why I did not receive the variable passed with the $_POST in my php. So what I finally proposed is the following:

    In my fla/swf doc:

    to import flash.net.URLVariables;

    import flash.net.URLRequest;

    import flash.net.sendToURL;

    var urlVariables:URLVariables = new URLVariables;

    urlVariables.amount = "5";

    var urlRequest:URLRequest = new URLRequest ("http://mirador.mx/oaxaca/disco/receive_test.php");

    urlRequest.data = urlVariables;

    sendToURL (urlRequest);

    In my php file:

    $amount = $_GET ["amount"];

    echo "' AMOUNT IS:". " $amount;

    Now for all of you who have been following this thread, or which can be read in the future, I know that we we started with AS2 and finishing here with AS3 but I didn't know why it worked until I I'm so fed up I've changed in AS3 to see if I could understand. I, like many others I guess, felt a bit intimidated with AS3 and was unwilling to give it a try, but I highly recommend that you dive into it because once get you a grip on it is much more functional.

    So I m going to mark this thread as a response and hope it saves someone else all the time and the frustration that he made me... Good programming!


  • Pass Variables from Flash to PHP

    Good day nice webmates. I hace this situation:

    I created a couple of text fields in flash "check in" and "check out" to a small reservation system, where the user is supposed to enter data (two variables) and then those two dates should go to the next page of PHP (which is already done) and work with this date and other new variables... but I'm not who is the best way to "transfer" these variables of the flash in the php file...

    I would appreciate your answer, this is a very urgent question... Thanks in advance!

    Citations are missing inside of $_POST. It should be $_POST ["checkin"]

  • undefined resutl tryng to get data from flash with php

    Hello

    I'm not a coder, but I understand the way that it work and can handle already-written script. I'm going through with a problem that I do not understand why is happening. I have a php and AS3 to get results from the database. Php works fine since I test. but demand for the Flash gives me a result "undefined". I have a text box on the flash file in which is supposed to show the results of the php. So far, this code:

    AS3:

    import flash.display.*;
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequestMethod;
    
    
        
    // Assign a variable name for our URLVariables object
    var variables:URLVariables = new URLVariables();
    //  Build the varSend variable
    var request:URLRequest = new URLRequest();
    request.url = "ckBxSample_disp.php";
    request.method = URLRequestMethod.POST;
    request.data = variables;
    // Build the varLoader variable
    var varLoader:URLLoader = new URLLoader();
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader.addEventListener(Event.COMPLETE, completeHandler);
    try
    {
        
        varLoader.load(request);
    }
    catch (error:Error)
    {
        trace("Unable to load URL");
    }
    // Handler for PHP script completion and return
          function completeHandler(event:Event):void{
           // Load the response from the PHP file
          if (event.target.data.returnBody == "") {
            output_txt.text = "No data coming through";
          } else {
            output_txt.condenseWhite = true;
            output_txt.htmlText = "" + event.target.data.returnBody;
            
          }
        
        }
    
    // Send the data to the php file
    varLoader.load(request);
    // Ready the variables for sending
    variables.requester = "phpRows";
    
    

    in php:



    If ($_POST ['applicant'] == 'phpRows') {}

    SQL connection code

    then mysql query here

    $sql = mysql_query ("SELECT blah blah blah

    then the while loop for all records, I like to shoot

    While ($Row = blah) {}

    call lines

    $id = $row ['id'];

    sending the results of th calle by flash

    $body = "$id";

    }

    Flash results

    Print "returnBody = $body";

    Close con

    mysql_close();

    Exit();

    }

    It is most of the code and I get a result that is not defined in the text box in flash

    can anyone help? Please

    Thanks in advance

    PHP is badly formatted.  use:

    <>

    I have remove the requirement to show the result of the database

    application of Flash

    ($_POST ['applicant'] == 'phpRows');

    Connect to the databese

    include_once 'connect_to_mysql.php '.

    $tbl_name = 'table_name ';

    $body = "";

    $con = mysql_connect ($mysql_hostname, $mysql_user, $mysql_password)

    or die ("Opps Fail to connect to the host");

    @mysql_select_db ($mysql_database, $con) or die ("Opps fail to connect to database");

    $sql = mysql_query ("SELECT * FROM $tbl_name");

    $result = mysql_query ($sql);

    While ($row = {mysql_fetch_array ($sql))}

    $id = $row ['id'];

    $uname = $row ['uname'];

    $client_song = $row ["client_song"];

    $body = "$id & $uname & $client_song;

    }

    Print $body;

    mysql_close();

    Exit();

    ?>

  • Sending mail from flash

    OK with a lot of help from Kglad Ned and Raymond, I have an ASP file that sends an email but as it is, he gets all the HTML form inputs, I've tried to revise it to obtain information from flash, but nothing happens to the asp origenal is as follows...

    < % option Explicit % >
    < %
    ' Declare variables
    Dim sMsg
    Dim sTo
    Dim students
    Dim objects
    Dim sTextBody
    Dim sHTMLBody

    Dim confSendUsing
    Dim confServer
    Dim confPort

    confSendUsing = 2
    confServer = "smtp.tde.com" ' the SMTP server name or Ip address
    confPort = 25

    «Get the data from the previous page»
    sTo = Request ("OTS")
    Students = Request ("sFrom")
    Objects = Request ("sSubject")
    sTextBody = Request ("sTextBody")
    sHTMLBody = Request ("sHTMLBody")

    "Run only if it is not the first time.
    If Request.Form <>"" then

    Dim objMail
    'Create the mail object.
    Set objMail = Server.CreateObject ("CDO. Message")
    "Set key properties.
    objMail.From = students
    objMail.To = sTo
    ObjMail.Subject = objects
    objMail.TextBody = sTextBody
    objMail.HTMLBody = sHTMLBody


    objMail.Configuration.Fields.Item _
    ("'http://schemas.microsoft.com/cdo/configuration/sendusing") = confSendUsing
    The name or the IP Address of the remote SMTP server
    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = confServer
    "Server port
    objMail.Configuration.Fields.Item _
    (""http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = confPort
    objMail.Configuration.Fields.Update


    'Send email '.
    objMail.Send
    ' SMsg set that will be used later
    sMsg = "your message has been sent to:" & sTo ".

    "Clean-up
    Set objMail = Nothing

    End If
    % >
    < html >
    < head > < title > SendMail < / title > < / head >
    < body >
    < do action = "< % = Request.ServerVariables % >" method = "post" > "
    < table >
    < b >
    < td > Send to: < table >
    < td > < input type = "text" name = "sTo" value = "< % = sTo % >" > < table >
    < /tr >
    < b >
    < td > Send to: < table >
    < td > < input type = "text" name = 'students' value = '< % = % of students >' > < table >
    < /tr >
    < b >
    < Td > Message Subject: < table >
    < td > < input type = "text" name = "objects" value = "< % = items % >' > < table >"
    < /tr >
    < b >
    Body text of Message < td >: < table >
    < td > < textarea cols = "60" rows = "5" name = "sTextBody" >
    < % = sTextBody % > < / textarea > < table >
    < /tr >
    < b >
    < td > HTML Message body: < table >
    < td > < textarea cols = "60" rows = "5" name = "sHTMLBody" >
    < % = sHTMLBody % > < / textarea > < table >
    < /tr >
    < b >
    < td > < table >
    < td > < input type = "submit" name = "Submit" value = "Submit" > < table >
    < /tr >
    < /table >
    < hr >
    < % = sMsg >
    < / make >
    < / body >
    < / html >

    IT WORKS PERFECTLY

    I tried to omit the HTML like this:

    < % option Explicit % >
    < %
    ' Declare variables
    Dim sMsg
    Dim sTo
    Dim students
    Dim objects
    Dim sTextBody
    Dim sHTMLBody

    Dim confSendUsing
    Dim confServer
    Dim confPort

    confSendUsing = 2
    confServer = "smtp.tde.com" ' the SMTP server name or Ip address
    confPort = 25

    «Get the data from the previous page»
    sTo = Request ("OTS")
    Students = Request ("sFrom")
    Objects = Request ("sSubject")
    sTextBody = Request ("sTextBody")
    sHTMLBody = Request ("sHTMLBody")

    "Run only if it is not the first time.
    If Request.Form <>"" then

    Dim objMail
    'Create the mail object.
    Set objMail = Server.CreateObject ("CDO. Message")
    "Set key properties.
    objMail.From = students
    objMail.To = sTo
    ObjMail.Subject = objects
    objMail.TextBody = sTextBody
    objMail.HTMLBody = sHTMLBody


    objMail.Configuration.Fields.Item _
    ("'http://schemas.microsoft.com/cdo/configuration/sendusing") = confSendUsing
    The name or the IP Address of the remote SMTP server
    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = confServer
    "Server port
    objMail.Configuration.Fields.Item _
    (""http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = confPort
    objMail.Configuration.Fields.Update


    'Send email '.
    objMail.Send
    ' SMsg set that will be used later
    sMsg = "your message has been sent to:" & sTo ".

    "Clean-up
    Set objMail = Nothing

    End If
    % >

    and he in contact with this flash AS3:

    Stop();
    emailfrom_txt. Text = "[email protected]";
    emailto_txt. Text = "[email protected]";
    emailbody_txt. Text = "";
    emailsubject_txt. Text = "";
    htmlbody_txt. Text = "";

    submit_btn.addEventListener (MouseEvent.CLICK, sendInfo);

    var emailfrom = emailfrom_txt.text;
    var emailto = emailto_txt.text;
    var emailsubject = emailsubject_txt.text;
    var emailbody_txt.text = emailbody;
    HTMLBody = htmlbody_txt.text var;

    function sendInfo (e:MouseEvent): void {}
    var varSend:URLRequest = new URLRequest ("mailer4.asp");
    varSend.method = URLRequestMethod.GET;
    var urlVar:URLVariables = new URLVariables();
    urlVar.sFrom = emailfrom;
    urlVar.sTo = emailto;
    urlVar.sSubject = emailsubject;
    urlVar.sTextBody = emailbody;
    urlVar.sHTMLBody = htmlbody;
    varSend.data = urlVar;
    var urlLDR:URLLoader = new URLLoader();
    urlLDR.addEventListener (Event.COMPLETE, completeF);
    urlLDR.load (varSend);
    }

    function completeF(e:Event) {}
    trace ("Complete");
    trace (URLLoader (e.Target). Data);
    trace (emailto emailfrom emailsubject, emailbody, htmlbody);
    }

    What did I miss?

    A button "submit" that the script sends him only if mail was in a hurry - as is the case in an html form.

    Remove these 2 lines:

    If Request.Form <> "" then

    End If

    ... but leave what's between the lines

  • Sending vars from Flash php for various events?

    Hello

    I have an AIR application that downloads a txt file to a server, and I have a progress bar set up in the AIR for the user.

    The php file that handles the download then open the txt file, analyzes and sanitize content, and inserts them into mysql.

    I was wondering if there is a way to make php tell Flash what is happening at each stage of the operation?

    For the moment, my progress bar gets to 100%, once the txt file stops downloading but crashes then until php ended the backend stuff.  It's very well - I like the movieclip of progress bar remains there until the mysql insert is complete, but I was wondering if it would be possible to reset the progress of return and move as php continues with the insert analysis and mysql, or return a series of vars text saying 'Parsing text file' then 'update database '?

    I understand that you can only echo Flash once, and I also came across this Flash bug which does not accept variables back when you download a file instead of simply downloading variable.

    Thanks for your help and happy new year!

    Shaun

    PHP can echo data back to Flash more than once.

  • pass variables from flash to authorware

    Hello

    If I have a button in flash and want to send a string of varibales to authorware:
    -example code-
    Flash code.
    {We (Release)}
    fscommand ("variable", "var1, var2, var3, var4")
    }
    Authorware code.
    EvalAssign (EventLastMatched [#command] ^ ": = EventLastMatched [#args]")
    Trace (EventLastMatched [#args])
    ActionFuntion (EventLastMatched [#args])
    Quit()

    In the authorware file, I would like to highlight this string and breakit in authorware and apply it to the ActionFuntion.

    Help, please.

    Thanks daniel

    If you have a string "var1, var2, var3, var4" you want to get each
    element of?

    Repeat with i = 1 to LineCount (EventLastMatched [#args], ',')
    lines : = GetLine (EventLastMatched [#args], I, I, ',')
    end repeat

    Must establish each element of the sting in a separate list item in the
    linear list of lines. I really don't understand what you are tying to
    do, so I use a list here for demonstration purposes, but perhaps you
    you want to replace the second line with:

    ActionFunction (GetLine (EventLastMatched [#args], i, i, ','))

    Who will call ActionFunction each time that the loop works and send it to the
    next element in the chain. In your case, it will call...

    ActionFunction ("var1")
    ActionFunction ("var2")
    ActionFunction ("var3")
    ActionFunction ("var4")

    -What are you trying to achieve?

    Mark

    deerowbear wrote:
    > Sorry that I misunderstood. When I Trace (EventLastMatched [#args]) in authorware I have
    > get var1, var2, var3 var4. The function call an external dll, passing those
    > variables off the coast and an ActionFunction in a dll file.
    >
    > Thanks daniel
    >
    >
    >
    >

    --
    ------------------------------------------------------
    Multimedia synchronization command Authorware:

    www.authorwarextras.co.UK--> orders

    Synchronization of media with ease!

    EuroTAAC eLearning 2007
    www.eurotaac.com

    www.AuthorwareXtras.co.uk
    www.freelists.org/List/flashelearning

  • CF pass variables from Flash

    Hello:

    Basically I want Coldfusion to pass the date Flash server. But I ' #theDt # ' instead of the value of "theDt" Please see the code below:

    Thank you in advance.

    ************************************************
    theDate.cfm

    < cfsetting enableCFoutputOnly = "Yes" >
    < cfset theDt = dateFormat (now (), 'dd-mm-yyyy') >
    < cfoutput >
    & serverDate = #theDt #.
    < / cfoutput >
    *****************************************************************

    var my_lv:LoadVars = new LoadVars();
    my_lv. OnLoad = {function (success:Boolean)}
    {if (Success)}
    theDate.text = my_lv.serverDate;
    theDate.text = this ["serverDate"];
    theDate.text = this.serverDate;
    } else {}
    var localDate:Date = new Date();
    theDate.text = (localDate.getMonth()+1)+"/"+localDate.getDate()+"/"+localDate.getFullYear ();
    }
    }
    my_lv. Load("C:\\CFusionMX7\\wwwroot\\OC\\theDate.cfm");
    ***************************************************************

    my_lv. Load("C:\\CFusionMX7\\wwwroot\\OC\\theDate.cfm");

    You're not "enforcement" a page of the CF, just read the content.

    The road should be something like (if you are testing your machine):
    my_lv. Load (" http://127.0.0.1//OC//theDate.cfm"); or the corresponding URL (and the Web server must be configured to run CF pages)

    Concerning

  • High Score Table: writing a Simple with Flash and PHP text file

    I'm having a problem getting Flash to work with PHP that I need Flash to read and write to a text file on a server to store data simple name partition for a games Hi score table. I can read the text file in Flash fairly easily, but I also have to write to the file when a new high score is reached, so I need to use PHP to do that. Can I send data from flash to php by POST file, but so far it does not. The PHP file is confirmed that the work that I added an echo in the file that displays a message to verify that the server is running PHP - files were also uploaded to a remote server so I could test them correctly. Flash code is as follows:

    FileWriter php

    var myLV = new LoadVars();

    sendData() {} function

    //sets variable 'hsdata' to send to php

    myLV.hsdata = myText;

    myLV.send ("hiscores.php");

    }

    I believe that it sends the variable "myText" in the php file in a variable called 'hsdata' I want the php file to write to a text file. The mytext variable is just a long chain that has all of the partitions and the names in the scores. OK, XML would be best way to do it, but for the speed, I want to just get the basic features of work, so store a shot of simple text is sufficient for now. The PHP code that reads the Flash variable "hsdata" and wrote for the "scores.txt" text file is due to:

    <? PHP

    sets the variable to the data posted from flash

    $flashdata = $_POST ['hsdata'];

    File Manager opens the file and clears all content with arg w

    $fh = fopen ("scores.txt", "w");

    Adds data to the file

    fwrite ($fh, $flashdata);

    closes the file

    fclose ($fh);

    echo "php file works;

    ? >

    Any help with this would be greatly appreciated - once I get php to write text files simple I should be ok. Thank you.

    var outLV = new LoadVars();

    var inLV = new LoadVars();

    sendData() {} function

    outLV.hsdata = 'Hello from Flash';

    outLV.sendAndLoad ("http://www.mysite.com/hiscores/test23.php", inLV,"POST");

    }

    inLV.onLoad = {function (success)}

    If (success) {}

    sets the dynamic text box to show the variable sent by php

    statusTxt.text = this.phpmess;

    } else {}

    statusTxt.text = 'No Data Received';

    }

    };

    It works well and function of inLV.onLoad of the reports it receives data, but does not display the variable received from PHP. The PHP file is like this:

    <>

    $mytxt = $_POST ['hsdata'];

    $myfile = "test23.txt";

    $fh = fopen ($myfile, 'w');

    Adds data to the file

    fwrite ($fh, $mytxt);

    closes the file

    fclose ($fh);

    $mess = "Hello there php ';

    echo "phpmess =". "." $mess;

    ?>

  • Flash to PHP using LoadVars.send


    For the life of me, I've tried everything:
    I searched for LoadVars on Adobe forum, David Powers used, google books 'flash to php', LoadVars, etc and tried sendAndLoad, shipment and use of $_POST, $_GET, $_REQUEST. $HTTP_POSTVARS but I continue we get this same error. advice please?

    I have a Unix server running Apache/PHP 4 - LoadVars worked to load pairs name / value in a table - see thread)

    My goal with this simple application is to prototype can pass a variable from flash to a PHP variable.

    Parse error: syntax error, unexpected T_VARIABLE in flash_to_SQL.php on line 5 the meantime

    ActionScript 2.0:

    var c: LoadVars = new LoadVars();
    c.testing = "123FOUR";
    c.Send (' http://127.0.0.1/flash_to_SQL.php ',' _self', 'POST');

    php code: (I also tried $_POST, $_GET, $_REQUEST. $HTTP_POSTVARS)
    <? PHP

    MySQL 4.1.2 php 4, NO mysqli

    ECBO $_REQUEST ['test'];
    / ? >

    This is WHAT WORKS! THANKS kglad - I also put a kudo to you on my screen.
    Tip: I had to make the php file to write the contents of the variable in a file, because it doesn'tdisplay on the screen with echo so that the variable passed from flash to php.

    Adobe document source: http://livedocs.adobe.com/flashlite/2/main/00000572.html

    var submitListener:Object = new Object();
    submitListener.click = {function (evt,:Object)}
    var result_lv:LoadVars = new LoadVars();
    /*
    result_lv. OnLoad = {function (success:Boolean)}

    If (success) {}
    result_ta. Text = ' sent successfully! ";
    } else {}
    result_ta. Text = 'Error connecting to server.';
    }

    };
    */
    var send_lv:LoadVars = new LoadVars();
    send_lv. NME = "Test Server2."
    Sending.Text = send_lv.nme;
    send_lv.sendAndLoad ("loadvars.php", result_lv, "POST");
    //};
    submit_button.addEventListener ("click", submitListener);

    <>
    $contents = $_POST ['nme'];
    echo $contents; DISPLAYS NO CONTENT
    Open the file write-only - used to view the contents of the _POST variable sent by LoadVars
    $file = fopen ('loadvars.txt', 'w');

    write content
    fwrite ($file, $contents);

    Close the file
    fclose ($file);

    ?>

  • values between Flash and PHP

    I use AS2 and passing some values from flash to php, files flash is on page file1.php values pass very well, he pass values when the user, click the button

    When the button is pressed {var myVal:LoadVars = new LoadVars(); myVal.flieName = "fileid1"; myVal.send ("file1.php", "_parent", "POST");}

    Problem: when she passes the values, it refreshes the page and Flash file is also refreshed, and Flash from frame 1 and all the values on flash becomes by default, in other words, when the user click on "file1.php" is submitted, so that the page is refreshed what's the solution, which, after passing the values from the page rest or flash remains as it is (do not update content)

    use:

    {

    var receiveLV:LoadVars = new LoadVars();

    {receiveLV.onData = function (src)}

    }

    var myVal:LoadVars = new LoadVars(); myVal.flieName = "fileid1"; myVal.sendAndLoad ("file1.php", receiveLV, "POST"); }

  • Problem passing variable from PHP to Flash

    I'm moving a single variable from PHP to Flash. However, I can't quite make it work.

    In a PHP file named data.php, I use:
    "$query = SELECT SUM (Debt) As Total OF THE debtclock;
    $result = mysql_query ($query);
    $debt = mysql_result ($result, "Total");
    Print "debttotal = $debt";

    In Flash 8 Actionscript, I use:
    loadVariables("data.php","0");

    If I understand correctly, this should make the variable available in Flash debttotal.

    Can someone tell me where I'm wrong?

    Try this:
    loadVariables ("data.php", _level0);
    The 2nd parameter specifies the target that receives variables, '0' is not a valid value for this. With _level0, variables will be found in the root timeline, so you can access it with _root.debttotal (from _level0) or _level0.debttotal (on a different level than _level0).

    Welcome,
    blemmo

  • Appeal of a variable from within an AS3 movieclip in Flash CS4

    I'm trying to back up a string variable from within a movieclip that is in an another movieclip on the main timeline to help:

    trace (VariableString);

    and also

    trace (stage. VariableString);

    No work

    The variable is a textfield of entry as well as traces very well when it is on the main timeline, but won't work inside the movieclip. I am using Actionscript 3 in Flash CS4.

    I appreciate this has probably been discussed before on this forum but I can't find an answer of difinitve that seems to work.

    Thank you

    When I put "MovieClip (root)" I tried that literally... not MovieClip1 (root).  You will need to cast to the class of the root object, who, most often using MovieClip() enough (among others, like object).

    What I don't see is happening is that you be able to get the value of the text of MovieClip1 the way that you say you do.  If MovieClip1 contains a text input component, then to get the value of this text you need to target the text property of the element inside the MovieClip1, as in...

    VariableString1 = MovieClip1.textInputName.text.

  • Flash and PHP

    Hi, let's say I have a dynamic text field (name of the variable is "txt") that I wanted to read a PHP file and output the content from there.

    My AS code is:

    var myPHP:LoadVars = new LoadVars();

    myPHP.load ("variables.php"); my php file

    myPHP.onLoad = function (success: Boolean) {}

    If (success) {}

    txt = myPHP.msg; display content from php

    }

    }

    PHP code in variables.php:

    <? PHP

    Define Variables

    $msg = ($_GET ['msg']);

    Send it to Flash

    echo "msg = $msg;

    ? >

    If I key in the url as follows and send something to the msg:

    variables.php? MSG = Hello

    It will echo "msg = Hello", but the text inside the flash field turns out to be empty, not indefinite or anything like that. However, if I hardcode the php file from:

    $msg = "hello";

    It will always echo "msg = Hello" but the flash file displays the text accordingly.

    Can someone tell me why? Thank you!

    parseQueryF() returns an object with your variables as keys.   Thus,.

    var queryObj:Object = parseQueryF (your_url_string_with_query);

    trace (queryObj.sender, queryObj.Receiver);

    do not change below.

    function parseQueryF(s:String):Object {}

    var o: Object = {};

    var s1:String = s.split ("?") [1] ;

    var a:Array = s1.split ("&"); ")

    for (var i: int = 0; i<>

    var varVal: Array = a [i] .split ("=");

    o [varVal [0]] = varVal [1];

    }

    }

    p.s. Please mark answers useful/correct, if there is.

Maybe you are looking for