Tenho um arquivo EnviaNome.php que envia a variável nome pelo método POST
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="formulario" name="formulario" method="post" action="CarregaFlash.php"> <label>Escreva seu nome: <input type="text" name="NomeEscrito" id="NomeEscrito" /> </label> <label> <input type="submit" name="botao" id="botao" value="OK" /> </label> </form> </body> </html>
Tenho um arquivo "verdados.php" que escreve a variável nome passada pelo form anterior em um arquivo "conteudo.txt"
<?php
/*
* Created on 14/06/2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$filename = "conteudo.txt";
$somecontent = "frase=" . utf8_decode($_POST['NomeEscrito']) . "&";
// Tendo certeza que o arquivo existe e que há permissão de escrita primeiro.
if (is_writable($filename)) {
// Em nosso exemplo, nós estamos abrindo $filename em modo de append (acréscimo).
// O ponteiro do arquivo estará no final dele desde
// que será aqui que $somecontent será escrito com fwrite().
if (!$handle = fopen($filename, 'w')) {
print "Erro abrindo arquivo ($filename)";
exit;
}
// Escrevendo $somecontent para o arquivo aberto.
if (!fwrite($handle, $somecontent)) {
print "Erro escrevendo no arquivo ($filename)";
exit;
}
print "Sucesso: escrito ($somecontent) no arquivo ($filename)";
fclose($filename);
} else {
print "O arquivo $filename não pode ser escrito";
}
echo "<br><a href=\"EnviaNome.php\">Voltar</a>";
echo "\n Variável post depois= " . $_POST['NomeEscrito'] . "\n";
echo "\n Variável filename depois= " . $filename . "\n";
echo "\n Variável somecontent depois= " . $somecontent . "\n";
?>Tenho o arquivo "abretxt.swf" que possui o actionscript que lê a variável nome no arquivo de texto
System.useCodepage = true;
this.frase = "";
/*this.frase.removeAll();*/
/*System.security.allowDomain("http://localhost/");*/
var frase:String = "";
var receber:LoadVars = new LoadVars();
receber.onLoad = function($sucesso){
trace($sucesso);
if($sucesso == true) {
frase += this.frase;
}else{
frase = "erro";
}
}
receber.load("http://localhost/SiteFlash/conteudo.txt");Grato,

Help














