PHP and Flash

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

PHP and Flash

Post 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 :)
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post 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
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

sorry :
id="myflash.swf?mid=<?=$_REQUEST['mid']?>"
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post 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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post by Jade »

Lol, what would I do without you guys??!!

Many Thanks
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post 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.. :)
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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 ;)
Post Reply