A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: As2 php text file issue

Hybrid View

  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    40

    As2 php text file issue

    Basically, I have one php file on my server which shows all files in a directory, a flash file to load the data, another php file that takes the names of the directory's files from flash and attempts to load the text files into flash. I can't figure out what's wrong with it, only that when flash catches the print/echo from php, it skips over the variable $theData which contains all the text file information. Any help would be appreciated. Thanks

    AS2 Code:
    var text_In:LoadVars = new LoadVars();
    var text_Out:LoadVars = new LoadVars();
    text_In.onLoad = function() {
    reader = text_In.book;
    };
    thing.onEnterFrame = function() {
    text_Out.bookname = load_Bookname;
    text_Out.sendAndLoad("http://lozdod.zxq.net/book_loader.php",text_In,"GET");
    };


    Text File Loading PHP Code:
    <?php
    $myFile = $_GET['bookname'];
    $fh = fopen("./books/$myFile", 'r');
    $theData = fread($fh, filesize($myFile));
    fclose($fh);
    print "&book= $theData";
    ?>

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    this means you are sending requests to the server at your framerate - are you trying to kill the server? There should be some other event to trigger loading

    The text loading has a potential problem: it will stop at the first & character encountered in the book ... so the story should not be talking about someone carrying a Smith & Wesson gun. There is urlencode() or perhaps just a sequence of two ereg() as a remedy
    Code:
    $theData = ereg_replace("%","%25",ereg_replace("&", "%26",$theData));
    Musicman

  3. #3
    Member
    Join Date
    Sep 2008
    Posts
    40
    Sorry, turns out it was a stupid mistake.
    $fh = fopen("./books/$myFile.txt", 'r'); instead of $fh = fopen("./books/$myFile", 'r');
    But thanks for the input. I took some precautions against the "&" issue disabling use of it for now.

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