Comunidad de diseño web y desarrollo en internet online

Guardar datos, variables en un artxibo txt

Citar            
MensajeEscrito el 29 Oct 2008 11:29 am
Hola,

Alguien sabe como guardar datos/variables desde Flash en un artxibo txt. Me he bajado un par de tutoriales donde lo hace mediante php. pero no consigo hacerlos funcionar...

Gracias!!!

Por Eki

39 de clabLevel



 

2004

firefox
Citar            
MensajeEscrito el 29 Oct 2008 12:18 pm
¿Que errores te dan?, si no nos enseñas el código no podremos ayudarte en nada.
En cristalab hay varios tutoriales/tips sobre el tema.

Por One

Claber

1488 de clabLevel

5 tutoriales

Genero:Masculino  

Programador Web

chrome
Citar            
MensajeEscrito el 29 Oct 2008 12:24 pm
Es este tutorial:

http://www.flash-db.com/Tutorials/saving/savingData.php?page=2

En mi script de Flash va esto:

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") //php
//myData.sendAndLoad("save.asp", myData, "POST") //asp
//myData.sendAndLoad("save.cfm", myData, "POST") //cf
}
}
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="Ok") {
this.msg = "Submited data was saved"
} else this.msg = "Error in saving submitted data"
gotoAndStop(2)
}
stop()

Y en el PHP esto:

<?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("anastasio.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok";
else echo "writing=Error";
fclose($fp);
?>

Lo quiero hacer en una carpeta, ara usarlo offline, en local. Tanto el swf como el php estan en la misma carpeta y he creado el archivo "anastasio.txt". Pero me da error y no escribe nada en el txt.

Gracias,

Un saludo!

Por Eki

39 de clabLevel



 

2004

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.