Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Send PHP Variables (recieved from MySQL) to Flash (actionsscript)

Hi there!

I´m totally new to actionsscripting, but I´m pretty good with PHP.

Now i need to get variables from a MySQL-database using PHP, and send the variables to be used in Flash (I´m currently using Flash MX).

How do I do it?

Thanx in advance!!!

  • 3
  • 3
1 Solution
the general idea is to have PHP output a query_string equivalent, which you can then input using loadVariables in ActionScript.

http://www.flash-db.com/Tutorials/loading/ is a good tutorial for this

a_80Author Commented:
Thanks for that, but i need another way (if there are any :S)

Let me describe my problem more thoroughly.

I have a flash movie including a worldmap (just a jpeg-image) and a "cross" made out of two lines which are converted to a movieclip-symbol.

I want this cross to move to a location, which is decided by the values from php.
The problem is, that the file index.php gets the coordinates for this cross by the surfer.

The surfer clicks the link to se where Thailand is located.
Then the string looks like this:
The index.php includes the map.swf, which needs the coordinates, to place the cross over the correct location on the map.

Is there any way i can solve this?
I cant put a temporary number in a sql-database (or a text-file), because another surfer can click the link, requesting another country, at the same time...

Please help!!!


OK, apparently (I haven't tested this) if you call the Flash movie with a query string appended to it:

<PARAM NAME=movie VALUE="flaMovie1.swf?page=2&x-coordinate=112&y-coordinate=55">
<EMBED src="flaMovie1.swf?page=2&x-coordinate=112&y-coordinate=55"

then you can get at the variables using _root.x-coordinate and _root.y-coordinate in the ActionScript

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

a_80Author Commented:

No, It doesn´t seem to work...
But there might be something wrong wtih the swf, and my way to get the variables.
Can you try it?
Or maybe I can send you my fla and php file?
I am pretty desperate to get on with this, and it would be super if it was as easy as you desribed in your second comment...

If I an send you my files, please send me an email at
anders@vkab.se and i will reply with my files...

Thanx in advance, and i promise you, that if you solve this one... you will be greatly rewarded!!!

OK, well the idea above came from http://www.permadi.com/tutorial/flashQueryString/ - but there are a couple more ideas there to look at
a_80Author Commented:
Now it´s working !

As I suspected, it was an error in my flash-file that caused the problems...

A million thanx for your help _Blue !!!


Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now