Flash with PHP

Hello All,

Okay I am wanting to pull in the total Number of members on our website through flash. (so as I can animate the number)

Now, I can pull the info in but the problem is the script takes about 1-2 seconds to pull the info of the MYSQL database, and by the time it is put into the dynamic text field in flash that animation is half over.

I downloaded a Poll in Flash that worked with PHP and MYsql so that I could see how they did it, but to no avial I cannot get it to FIRST load then display. So could you please help me!!! Anybody!

This is what I have now:

Frame 1 Starts to load the script to get variables (code I use):

loadVariables(“flash_getMembers.php”,“dummy”,“GET”);
stop();

On Frame 1 I have some text saying loading. This text I turn into a Instance named dummy - I then put this code in the instance:

onClipEvent(data){
_root.nextFrame();
}

on Frame 2 I place the text field that should display that data from the script.

Please is there a problem with any of this code, or somthing you can suggest??

Thanks for anyones help!

http://www.kirupa.com/developer/actionscript/flash_php_mysql.htm

That tutorial will tell you how to do it.

Hey Vash,

Thanks for the reply.

But the problem is I want the data to load then display. I have no problems getting the data info the swf - I just need it to load first then access.

For an example check this site out:

www.loopkit.com

they say loading external data. Then they run the site once loaded. But I can’ get that to work :frowning:

Never mind I came up with a solution check this!

Okay, On Frame 1 I make two Dynamic Text Fields.

  1. Called NC
  2. Called NB

Now I make NB a Instance and place this code within it:

onClipEvent (load) {
// assuming you have a personal web server and PHP installed locally
nv=0;
loadVariables (“http://www.atlantissgc.com/flash_test.php”, this, “GET”);
}
onClipEvent(data){
nv=1;
}
onClipEvent(enterFrame){
if(nv==0){
NB=“Loading…”;
}else{
NB=NC;
}
}

Now what this code does, is loads the information from the script, and places it within the NC field (which is not visible by the user) while NB waits to see if the variable nv has changed from 0 (not loaded) to 1 (loaded). Once 1 appears NB displays that value of NC.
:beam:

Mabye not the best method but this is the only one working for me hehehe