Page 1 of 1

PHP and Flash

Posted: Sun Jan 18, 2004 11:53 pm
by Jade
Hey, does anyone know how to get varibles from a URL to be passed into flash using php?? For example, if I want to get a member's ID to load the information for that member into flash the url would be http://www.mysite.com/member.php?mid=32.

Anyone know a way to get the mid number as 32 to load into flash as a variable?? If you have any clue as to how to do this let me know. Any help is much appreciated!

Jade as always :)

Posted: Mon Jan 19, 2004 1:05 am
by pelegk2
sure very simple
when u embed the flash in your php page
u have id="myflash.swf"
all u have to do is :
id="myflash.swf?mid=<?=_REQUEST['mid']?>"
when the page will load and the flash will load
theflash will have automaticlly a variable called mid with the given value
enjoy

Posted: Mon Jan 19, 2004 1:05 am
by pelegk2
sorry :
id="myflash.swf?mid=<?=$_REQUEST['mid']?>"

Posted: Tue Jan 20, 2004 6:04 pm
by Jade
Awsome, thanks so much. I did find that I had to

var mid = trace(mid);

but then it all worked! Thanks again for the help!

Jade

Posted: Wed Jan 21, 2004 12:04 am
by Gen-ik
Don't forget that if you add variables to the Flash movie URL then browsers will see that as the actual file name, and because of this the browser will think it's a new file a reload the entire movie whenever the URL (or attached variables) change.

If your movie is small this isn't a problem, but if it takes a while to load I would suggest creating a 'base' movie (a blank swf which will loads another swf file depending on the variable(s) you send to it).


Hope that makes sense.

Posted: Wed Jan 21, 2004 6:00 pm
by Jade
Lol, what would I do without you guys??!!

Many Thanks

Posted: Thu Jan 22, 2004 4:03 am
by igoy
Great... but this way it could also get lil' tidious if you need to get many vars in Flash movie.

just take a look at this thread, this might help you getting PHPvars in flash movie with more sofisticated way.

Here : viewtopic.php?t=11509


sorry for goin lil' off way, but hay... Gen-ik... have you been doing round of deviantart recently ??? your avataar looks nice.. :)

Posted: Thu Jan 22, 2004 7:53 am
by Gen-ik
Yeah there are lots of ways of getting vars into Flash... tagging them to the Flash file name is the easiest way but it can also be done via JavaScript or by loading a PHP page directly into Flash... which is how a lot of 100% flash-based sites work.

@ igoy http://genik.deviantart.com ;)