Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 1st, 2002, 03:33 PM
SiCo SiCo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: England
Posts: 107 SiCo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 56 m 24 sec
Reputation Power: 7
Send a message via Yahoo to SiCo
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.
__________________
Si

-----------------------------
ajb007 - Discuss the world of Bond

Reply With Quote
  #2  
Old February 1st, 2002, 05:07 PM
JeffCT JeffCT is offline
PHP & Ruby Developer
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,437 JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 5 h 36 m 40 sec
Reputation Power: 9
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:
echo "var_1=abcdefg&var_2=blahblah"

Reply With Quote
  #3  
Old February 1st, 2002, 06:29 PM
SiCo SiCo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: England
Posts: 107 SiCo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 56 m 24 sec
Reputation Power: 7
Send a message via Yahoo to SiCo
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

Reply With Quote
  #4  
Old February 1st, 2002, 10:08 PM
JeffCT JeffCT is offline
PHP & Ruby Developer
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,437 JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 5 h 36 m 40 sec
Reputation Power: 9
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.

Reply With Quote
  #5  
Old February 2nd, 2002, 06:52 AM
SiCo SiCo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: England
Posts: 107 SiCo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 56 m 24 sec
Reputation Power: 7
Send a message via Yahoo to SiCo
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

Reply With Quote
  #6  
Old February 2nd, 2002, 03:28 PM
ridemonkey ridemonkey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 11 ridemonkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old February 2nd, 2002, 03:35 PM
SiCo SiCo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: England
Posts: 107 SiCo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 56 m 24 sec
Reputation Power: 7
Send a message via Yahoo to SiCo
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!!

Reply With Quote
  #8  
Old February 4th, 2002, 09:24 AM
faerieprince faerieprince is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: omaha
Posts: 2 faerieprince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #9  
Old February 9th, 2002, 05:35 AM
SiCo SiCo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: England
Posts: 107 SiCo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 56 m 24 sec
Reputation Power: 7
Send a message via Yahoo to SiCo
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.

Reply With Quote
  #10  
Old February 11th, 2002, 09:54 AM
faerieprince faerieprince is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: omaha
Posts: 2 faerieprince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #11  
Old February 14th, 2002, 11:17 AM
NETbreed NETbreed is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 4 NETbreed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #12  
Old February 15th, 2002, 09:02 PM
sharky121 sharky121 is offline
...try and try again
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Lake Forest, CA, USA
Posts: 182 sharky121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 3 sec
Reputation Power: 9
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?

Reply With Quote
  #13  
Old February 16th, 2002, 04:51 AM
NETbreed NETbreed is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 4 NETbreed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #14  
Old February 16th, 2002, 12:49 PM
sharky121 sharky121 is offline
...try and try again
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Lake Forest, CA, USA
Posts: 182 sharky121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 3 sec
Reputation Power: 9
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-

Reply With Quote
  #15  
Old February 19th, 2002, 12:14 PM
sharky121 sharky121 is offline
...try and try again
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Lake Forest, CA, USA
Posts: 182 sharky121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 3 sec
Reputation Power: 9
Hey Steve,

I just bought your book on Amazon. Looking forward to reading it.

-Ben

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > PHP into Flash


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump