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

Posted on 2005-03-06
Medium Priority
Last Modified: 2010-04-06
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!!!

Question by:a_80
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 10

Expert Comment

ID: 13470684
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


Author Comment

ID: 13474399
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!!!


LVL 10

Accepted Solution

eeBlueShadow earned 1400 total points
ID: 13475034
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!


Author Comment

ID: 13475143

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!!!

LVL 10

Expert Comment

ID: 13475203
OK, well the idea above came from http://www.permadi.com/tutorial/flashQueryString/ - but there are a couple more ideas there to look at

Author Comment

ID: 13483999
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question