A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: PHP LoadVars help

Threaded View

  1. #1
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918

    PHP LoadVars help

    Hi guys. I want to store variables into a .txt file for flash to read them later. It's my first work on php so I don't know if there are better ways for doing this. In the php file (called "new.php") I have:
    PHP Code:
    <HTML>
    <BODY>
    <?
    $nombre_archivo = 'new.txt';
    $gestor = fopen($nombre_archivo, 'w');
    $contenido = "name=" . $name . "&score=" . $score;
    fwrite($gestor, $contenido);
    fclose($gestor);
    ?>
    </BODY>
    </HTML>
    That is for php to write over the file "new.txt" like this: name=yourname&score=yourscore, so flash can load the variables from the txt file using load (or loadVariables).
    Please try the swf here . You'll notice that the first time it stores the name and the score, but then if you try again it doesn't seem to work, or sometimes you have to wait a long time until it stores them.
    Does anyone know why is this happening?
    I'm attaching the .fla file, i'd like you to check it out please, cus I'm using loadVars and I'm not familiar with them, it's the first time I need them so I don't actually know how they work and there are some things in the code there that I don't even know what they do, they just work. So please if anyone could help me with this and tell me why is this happenning or a better and more efficient way to do it I'll really appreciate it.
    Thanx in advance

    p.s. thanx for the tute tonypa
    Last edited by PhobiK; 07-18-2009 at 02:44 AM.
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

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