PDA

View Full Version : Actionscript grab PHP vars



Coda
29-08-2008, 04:31 PM
Right i need some help, im using flash CS3 AS2 and i have made a simple mp3 player. I need the flash to grab a php variable and use it.

the php variable would be:


$getp[user]

And it needs to go where the bolded PHPVAR is:


playlist.load("playlist.xml?s=PHPVAR");

any ideas how to do this?

Dentafrice
29-08-2008, 05:44 PM
Why not just send it to the flash player via a variable in the filename.

Like

bla.swf?user=<?php echo $getp["user"]; ?>

Coda
29-08-2008, 08:30 PM
Thats what i did in the end.

in the flash object i had:


.swf?filename=<?php echo $getp[user]; ?>

and then in my actionscript i just put:


myVars = new LoadVars();
myVars.load("http://website.com/pagewiththevars.php");
myVars.filename;

playlist.load("playlist.xml?s="+filename);

and it worked :D

Dentafrice
29-08-2008, 08:34 PM
I would recommend you using <?php echo $getp["user"]; ?> for effiency.

Want to hide these adverts? Register an account for free!