PHP para acceder a variables con ActionScript

  • M12
  • Born
  • Born
  • No Avatar
  • Registrado: Oct 01, 2007
  • Mensajes: 1
  • Status: Offline

Nota Octubre 1st, 2007, 12:39 am

Im todavía aprender actionscript y php trabajar juntos. Estos son algunos archivos de muestra:

http://eltania.net/m12/testPHP.php
http://eltania.net/m12/test.swf

flash fuente:
http://eltania.net/m12/test.fla

El archivo swf se supone que debe mostrar una variable llamada "testData", ubicado en el archivo PHP. Pero en este momento, sólo dice "indefinido". Le agradecería cualquier ayuda, ya que el plazo de un proyecto se está acercando. Gracias montones hombre.

Para hacer más fácil la cosa, aquí está la fuente actionscript:

testData_load = new LoadVars ();

testData_load.onLoad = function () (
tdata var = testData_load [ "testData"];
)

_root.testData_load.load ( "testPHP.php");

this.txt = _root.tdata; <- (esta línea fija el texto para mostrar las variables de valor)

Y aquí está el código PHP:

<html>
<body>
<? PHP
$ testData = "trabajo";
echo "testData =". testData dólares;
>
</ body>
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Octubre 1st, 2007, 12:39 am

  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 1st, 2007, 10:43 pm

El formato de salida de PHP no está mal.
El código de Flash está bien, excepto una cosa: el alcance de la tdata variable.
Usted declara tdata dentro de una función, por lo que sólo está disponible en esa función.
Quite el "var" de allí y que funcione, ya que si no se declara como variable en la función, el flash se supone que es una variable para el movieclip actual.
Usted puede tener también
Código: [ Select ]
var tdata:String;
testData_load = new LoadVars();
testData_load.onLoad = function () {
tdata = testData_load["testData"];
}
testData_load.load("testPHP.php");
this.txt = tdata; <-- (this line sets the text to display the variable's value)
  1. var tdata:String;
  2. testData_load = new LoadVars();
  3. testData_load.onLoad = function () {
  4. tdata = testData_load["testData"];
  5. }
  6. testData_load.load("testPHP.php");
  7. this.txt = tdata; <-- (this line sets the text to display the variable's value)
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Publicar Información

  • Total de mensajes en este tema: 2 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 42 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC