|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP into Flash
I have searched the forums looking for an answer to this but I still don't really understand, can someone spell it out for me!
Basically I see that you have to pass the variables to the php movie in the form of a url, but where do you give it this string? Posts just say echo it but echo it where? I want a page which queries a mySQL db gets the datya, then this information is put into the main site which is flash. Basically to start with it will be text for an updatable section but I want to extend this once I understand it! Thanks for your help. |
|
#2
|
|||
|
|||
|
Those tutorials are right, you just echo out the data. You shouldn't be worrying about where to echo it because there's only one place echo sends the data. Just send it back like this:
PHP Code:
|
|
#3
|
|||
|
|||
|
Yes but where? You surely can't just echo it anywhere ont he page. Does it go at the end of the url to the swf or something?
Cheers |
|
#4
|
|||
|
|||
|
You can send variables to the swf file to the end of the url:
http://example.com/example.swf?var1=whatever But my example (and yours I'm assuming) is using PHP to communicate back to the SWF. In your movie, you use actionscript to call the PHP script: loadVariables("http://www.example.com/example.php"); Then in your PHP script, simply echo out the variables, and Flash will get them. |
|
#5
|
|||
|
|||
|
Arh I get it now!
What I now can't do is display the variables in Flash, I have a dynamic text box and somewhere says that if you give this the variable name then it should populate it but it isn't working. Is there another way to do this using the actionscript? Thanks for your help so far I will get there ![]() |
|
#6
|
|||
|
|||
|
There are two methods for getting external data into Flash. One is to add parameters to the file name in the object and embed tags contained in thie HTML that holds your flash.
<PARAM NAME=movie VALUE="swf/faq_scroll.swf?productID=34"> Or you can do a load variables command loadVariablesNum ("get_products.php", 0); In both cases you have to know WHERE the variables reside in the flash movie. They can be assigned a level, or they can live in any MC buried deep in your flash movie. The way that I keep track of my variables is that I ALWAYS preceed the variable name with a location. _level0.product tells flash to look for the variable product in level0, which is where we have loaded the data from our php script with the loadVariables command. So in you text area, you have a dynamic variable, rename it to _level0.var and it should get the value of that variable, assuming leve0 is where you have loaded it. |
|
#7
|
|||
|
|||
|
Ok, I probably should have mentioned that this is the first 'complex' bit of flash I have attempted, I know the basics but nothing really about action script. (But then I am sure you had already realised that!!).
How do I assign the variables to flash variable names. All I want to do is display some text from a mySQL database, I have got the PHP sorted and as far as I know Flash takes the variables from that. But from there I am lost. thanks for the help so far, it is seeping in . . . slowly!! ![]() |
|
#8
|
|||
|
|||
|
if you are looking to get an excellent understanding of how php/mysql/flash can work together, you ought to check out 'foundation php for flash' by friends of ED. i am currently reading this book because i am in the same place as you, but i know the action script side of it.
i have found the inclusion of php/mysql to be very easy, particularly if you already know them. the flash side is not too difficult. from what you seem to have gathered from the posts thus far, you are almost there. i think all you need to do is go into flash and use the text palette. once there, you can choose to create a static/input/dynamic text field. choose dynamic. in the same palette you can name the field. just give it the same name (IE: $fileName in PHP becomes fileName in Flash) and you ought to be good to go assuming your php and mysql are correct. to send from/to flash use: loadVariables ("nameOfFile.php", this, "POST"); in the above code, 'this' is just telling flash that the variables coming in are to be plugged into the calling page. this will work for both sending and receiving variables. hope this helps, and if you need a more indepth explanation just head to a local bookstore and check out the book mentioned above. it has helped me tons. |
|
#9
|
|||
|
|||
|
Thank you for your help I have now got it to work, you are right it is very easy, part of my problem was thta I was using various tutorials none of which seemed to work so I had bits from one and bits from another. The main problem was in the php one tutorial had told me to use rawurlencode() around the variables, but this was messing it up.
So thank you it is now very clear to me. |
|
#10
|
|||
|
|||
|
I am glad to have helped. Not to take anything away from this site because it is awesome (I was only recently introduced to devshed and find more and more useful bits on every visit!), but there is a site set up to support the book I mentioned. They deal only with incorporating Flash with PHP and MySQL. Their URL is: URL
The message board is a bit wonky in that once you follow a thread, when you return to the main board it automatically sticks you on the most recent message instead of where you last were. Otherwise, I think it is a useful place to visit. Good luck with your work. - Craig Coffman |
|
#11
|
|||
|
|||
|
Hi Craig,
Can you describe your problems with the phpforflash.com Message board a little further. This is the first time I've heard of a problem with the message board, but if it's something to with my coding then I'd be happy to try and sort it out! Regards, Steve Webster Author - Foundation PHP for Flash |
|
#12
|
|||
|
|||
|
Steve - A great idea with the flash forum.
Enhancements: Ability to edit your post. To return back to the list of forums with one click. Dynamically see your reply when responding. I keep hitting the grey area on the scroll bar to move it down - it would be nice to have this instead of having to drag the bar down. Rgds -BB-
__________________
what did you expect from a spanner? |
|
#13
|
|||
|
|||
|
Hiya,
Consider them all added to my to-do list (which is steadily running out of control ;o). Actually, the edit/delete post thing is already top of the list since a lot of people make simple mistakes in their post and have to reply to correct them. I also want to add a simple user control panel and profile section so that they can set up their details and footers etc. With regards to 'Dynamically see your reply when responding', do you mean like the Preview Reply feature here? Regards, Steve Webster Author - Foundation PHP for Flash |
|
#14
|
|||
|
|||
|
A preview would be nice, but I noticed that once I had submitted my reply it did not appear below the original post - I had to back out.
-BB- |
|
#15
|
|||
|
|||
|
Hey Steve,
I just bought your book on Amazon. Looking forward to reading it. -Ben |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > PHP into Flash |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|