View Full Version : php and dynamic text fields.
cerebro
10-02-2008, 01:19 AM
Hello people, I have just subscribed to your great forum.
I'd like to know if any of you could help me with a problem.
We want to display some text in a dynamic text field in a flash file (we are using AS2) from a table of a database (mysql).
When trying to do this locally, everything goes great, except when we publish it, it behaves weird, sometimes it shows the data sometimes not...
Any clue about what we are doing wrong?
cerebro
10-02-2008, 01:27 AM
In case you need it , Im posting the FLA of my project.
I also can post the PHP.
Thanks in advance!
cerebro
10-02-2008, 02:04 AM
Hello I already submited this to AS2 section, but I see this section is dedicated to SERVER SIDE, so Im giving a shot in here too. edited: THANKS MODS somebody already merged the topic in here!!! =)
I'd like to know if any of you could help me with a problem.
We want to display some text in a dynamic text field in a flash file (we are using AS2) from a table of a database (mysql).
When trying to do this locally, everything goes great, except when we publish it, it behaves weird, sometimes it shows the data sometimes not...
Any clue about what we are doing wrong?
cerebro
10-02-2008, 02:09 AM
We load text variables in flash this way, where coment1 is the name of the dynamic text field inside a MC with instance name "portadas" and texto1, 2, 3... are the variables loaded from PHP
var a = new LoadVars();
a.load("http://www.xxxxxxxxxxxxxx.com/citi/flash/cargarportada.php");
a.onLoad = function() {
texto_txt.text = this.nombre;
portadas.coment1 = this.texto1;
portadas.coment2 = this.texto2;
portadas.coment3 = this.texto3;
portadas.coment4 = this.texto4;
}
so this calls a function in our server, in this PHP where the code is like this
<?
session_start();
include_once("librerias/conexion.php");
conectar();
$sql=mysql_query("SELECT * FROM promociones");
desconectar();
$row=mysql_fetch_array($sql);
$texto1=$row["port1_coment"];
print("texto1=".$texto1);
$texto2=$row["port2_coment"];
print("&texto2=".$texto2);
$texto3=$row["port3_coment"];
print("&texto3=".$texto3);
$texto4=$row["port4_coment"];
print("&texto4=".$texto4);
?>
The problem is that this behaves erratic when publishing in Web, but locally the SWF works perfectly. It shows undefined index.
Thanks in advance.
inhan
10-02-2008, 02:12 AM
First thing that caught my eye was you've identical names for the same text field both in the variable and instance names. Delete the instance names (from the input text field under where you select dynamic/input/static text in the properties panel) and keep the variable names.
cerebro
10-02-2008, 02:27 AM
thx for the quick reply.
I already did the change, I only leave the VAR names.
Still Im getting the undefined index.
I dont know... I also thought about the permisions in FTP... ? since locally it works beautifully
cerebro
10-02-2008, 03:01 AM
I did a test variable in my swf file to post the variable object (all the content) that prints the PHP
I got this when trying online:
onLoad=%5Btype%20Function%5D
when testing locally, it gives me the right post which is
texto4=STAR%20WARS%3A%20Clone%20Wars%2E%20Disfruta %20de%20un%20nuevo%20episodio%20totalmente%20anima do&texto3=Noche%20De%20Graduacion%20Sangrienta%2E%20T iembla%20con%20el%20baile%20de%20graduacion%20mas% 20terrorifico&texto2=Mision%20Babilonia%2E%20Disfruta%20de%20una %20aventura%20futurista%20llena%20de%20accion&texto1=U2%203D%2E%20Vive%20la%20experiencia%20de%2 0un%20concierto%20lleno%20de%20energia%20en%203D&onLoad=%5Btype%20Function%5D
CyanBlue
10-02-2008, 03:15 AM
Howdy and Welcome... :)
Did you upload the SWF and the PHP in the same domain???
cerebro
10-02-2008, 03:17 AM
Yep,
I have php in
http://xxxxxxxxxxxxxxxxx.com/citi/flash/cargarportada.php
I have swf in
http://xxxxxxxxxxxxxxxxx.com/citi/flash/portada_citi.swf
I also did a success/fail stuff with the loadVars... it shows me FAIL (fracaso in spanish) when testing online .... it shows me SUCESS (exito) when testing locally.
CyanBlue
10-02-2008, 03:22 AM
That is not the same domain to Flash Player...
www.domain.com and domain.com are two different domains to Flash Player...
Stick to one and you should be fine... ;)
cerebro
10-02-2008, 03:29 AM
thanks man!!!
now , this works beautifully!!!
:)
Ill let you know when the project is finished ...its about a movie theater!
thanks again!
CyanBlue
10-02-2008, 03:31 AM
Glad to hear that... Don't forget to show us when you are done... ;)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.