Results 1 to 6 of 6

Thread: from flash to php and vice versa

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    from flash to php and vice versa

    ok, here is what i was trying to do. i wanted to use php backend for flash to read and write in text files. but there is a problem.

    my flash actionscript:
    Code:
    fname="ca.txt";
    	_root.strText="Loading... Please wait...";
    	loadVariablesNum("readMain.php?fname="+fname,0,"GET");
    and my php code:
    Code:
    <?
    #read the main file for contents
    
    #first open the file
    $fname=$_GET["fname"];
    if ($fname == "") {
        $fname="ca.txt";
    }
    
    $file=fopen($fname,"rb");
    
    #read from file and close it
    $mtext=fread($file,filesize($fname));
    fclose($file);
    
    echo "strText="+$mtext;
    ?>
    its not working. the flash shows the loading part and halts.

    what am i doing wrong?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: from flash to php and vice versa

    First off, all variables your PHP script returns are not formed correctly. All variables for Flash to use must begin with an &

    So it should look like
    Code:
    &strText=something
    Also, you should add an &eof=true at the end of the file. That way, you can tell when it finished loading the text (it's not instant and usually takes a few frames to do so).
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: from flash to php and vice versa

    you could just use flash vars in the object code in ur webpage... so you could have php generate the flash vars code.... then you wouldnt have to worry about files..

  4. #4
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: from flash to php and vice versa

    Have you looked into load XML from flash, then all you would need to do would be to ouput the data in an XML format from your PHP script.

  5. #5
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: from flash to php and vice versa

    Quote Originally Posted by Latin4567
    you could just use flash vars in the object code in ur webpage... so you could have php generate the flash vars code.... then you wouldnt have to worry about files..
    That's just what I showed him how to do and what he was trying to do...
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: from flash to php and vice versa

    worked..

    changed the last line
    Code:
    echo "strText="+$mtext;
    to
    Code:
    print "$strText=$mtext";
    thanx people

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