Foros del Web » Creando para Internet » Flash y Actionscript »

escribiendo en txt..

Estas en el tema de escribiendo en txt.. en el foro de Flash y Actionscript en Foros del Web. Bueno no puedo hacer q funcione esto...Modifique varias veces el codigo, pero no termina de funcionar...Y segui un tutorial que hablaba de esto... Lo que ...
  #1 (permalink)  
Antiguo 30/10/2007, 09:06
 
Fecha de Ingreso: marzo-2007
Mensajes: 782
Antigüedad: 17 años
Puntos: 16
escribiendo en txt..

Bueno no puedo hacer q funcione esto...Modifique varias veces el codigo, pero no termina de funcionar...Y segui un tutorial que hablaba de esto...

Lo que quier hacer es escribir el txt, mandando las variables desde el .swf y mediante el php escribir...

Creo que este codigo esta bien...y seguiria revisando el PHP, queria saber si alguien me puede decir si hay algun error, o si el .fla esta bien...Igualmente pongo el PHP para q vean de q se trata...

En PHP use el metodo "w" para crear el .txt o sobreescribirlo, igualmente lo cree texto le puse como nombre...

El .fla:

Cita:
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="ok") {
gotoAndStop(2)
status.text = "Submited data was saved"
} else status.text = "Error in saving submitted data"
}
submit.onPress = function(){
if(Title.text!="" && Comments.text !="" && Image.text!=""){
myData.Title = Title.text;
myData.Comments = Comments.text;
myData.Image = Image.text;
myData.sendAndLoad("save.php", myData, "POST")
}
}
stop()
El php


Cita:
<?php
//Capture data from $_POST array
$title = $_POST['Title'];
$comments = $_POST['Comments'];
$image = $_POST['Image'];
//Make one big string in a format Flash understand
$toSave ="Title=$title&Comments=$comments&Image=.$image ";
//Open a file in write mode
$fp = fopen("texto.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=ok&";
else echo "writing=Error&"
fclose($fp);
?>

Última edición por eybel; 30/10/2007 a las 09:15
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:09.