Im usando Flash MX 2004
Im intentando utilizar sendAndLoad para enviar datos a un script en Python, y luego tener la secuencia de comandos Python enviar datos de nuevo, pero no sólo está trabajando para mí.
La secuencia de comandos Python funciona bien cuando se llama directamente.
El archivo de flash funciona bien si uso la carga en un archivo de texto estático de la salida de un script en Python, en lugar de sendAndLoad para llamar a un script en Python.
Ellos simplemente no parecen querer hablar juntas.
Ive consiguió un texto dinámico llamado theDisplay, y un botón con este código:
on (release) {
theDisplay.text = "Please Wait...\n";
varReceiver = new LoadVars();
varSender = new LoadVars();
varSender.theText = "something";
varSender.sendAndLoad("myScript.py", varReveiver, "GET");
varReceiver.onLoad = function() {
theDisplay.text += varReceiver.theText;
};
}
- on (release) {
- theDisplay.text = "Please Wait...\n";
- varReceiver = new LoadVars();
- varSender = new LoadVars();
- varSender.theText = "something";
- varSender.sendAndLoad("myScript.py", varReveiver, "GET");
-
- varReceiver.onLoad = function() {
- theDisplay.text += varReceiver.theText;
- };
- }
-
Este es mi script en Python, y #058;
#!c:/progra~1/python243/python.exe -u
import cgi # To get the address from the URL.
# Print the Content-Type header. Without this it won't work.
print "Content-Type: text/plain\n\n"
# Get the text from the URL.
The_Form = cgi.FieldStorage()
myText = The_Form["theText"].value
# Write the text to a file.
FILE = open("text.txt","w")
FILE.write(myText)
FILE.write("\n")
FILE.close()
# Write the text back in the format that flash wants it in.
print "&theText=" + myText
- #!c:/progra~1/python243/python.exe -u
-
- import cgi # To get the address from the URL.
-
- # Print the Content-Type header. Without this it won't work.
- print "Content-Type: text/plain\n\n"
-
- # Get the text from the URL.
- The_Form = cgi.FieldStorage()
- myText = The_Form["theText"].value
-
- # Write the text to a file.
- FILE = open("text.txt","w")
- FILE.write(myText)
- FILE.write("\n")
- FILE.close()
-
- # Write the text back in the format that flash wants it in.
- print "&theText=" + myText
-
-