A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: how to save a textfield data to an external text file

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    4

    how to save a textfield data to an external text file

    Hey friends, i am working on a project in which a user enters something in a text field and then presses a button then the value of that text field is saved in an external text file., hope u understand my problem. Thanks in advance.

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    A very basic way is like so,

    your flash button command
    PHP Code:
    button.onPress = function()
    {
        
    SubmitData();
    };

    function 
    SubmitData()
    {
        var 
    SendData = new LoadVars();
        
    SendData.Word MyText.text;
        
    SendData.send("save.php","_blank","POST");

    and the matching php file called save.php like so (same directory)
    PHP Code:
    <?php  

    $FlashVar1 
    $_POST['Word'];
    $FlashVar2 "You saved this ".$FlashVar1;

    $Document "save.txt";
    $Saver fopen($Document,"w");

    fwrite ($Saver$FlashVar2);

    fclose($Saver);

    echo 
    $FlashVar2."<br / > here is the text file <a href='$Document' target='_blank'>Here</a>";

    ?>
    for home testing you will need your apache / IIS home server

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks but i want it for flash as 2 actionscript.pls giv me

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It is AS2, if you want to do it without a server side language then you will need to use AS3, which I am unable to help you with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center