PhotoDune

how to get variables from php to flash?

1540 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

hi everyone,

I am getting trouble in getting values of variables 
from  php in flash.

e.g. $variable1 = “myname” (in php)

how to display the text in a textbox in flash?

please help me.

thanks in advance.

1234 posts
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
  • United States
MBMedia says

when you echo in PHP that data goes back to flash as a String. Exactly how send to PHP and get a return response depends on AS version, but that can be googled ;)

1540 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

thanks mbmedia

I am using AS2 , flash 8

153 posts
  • Bought between 1 and 9 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 50 and 99 users
  • Sold between 100 000 and 250 000 dollars
  • United States
abenson says

Pass it into the SWFObject:

var so = new SWFObject("myfile.swf", "mymovie", "500", "400", "8", "#000000");
       so.addParam("menu", "false");
       so.addVariable("myVariable", "<?php echo $myVar ?>");
       so.write("flash");

In Flash, you can find it by calling:

_level0.myVariable

1234 posts
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
  • United States
MBMedia says

I guess I didn’t ask, is PHP writing the HTML page for flash play in (that’s abenson’s solution) or is it Flash communicating with PHP at runtime (what I was explaining)?

In flash 8 to communicate with php you use LoadVars and sendAndLoad, but my AS2 sucks from decayed lack of use so google those two things with PHP and you’ll be farther than if I help you :)

215 posts
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United Kingdom
Ziyad says

Here, I’ve quickly written a script on pastie. I haven’t debugged but I’m sure you can figure out anything wrong.

If you need any more help I’m always on the forum, or email me through my profile.

ActionScript

PHP

Note: For the actionscript I’ve written it in both AS2 and AS3 so make sure you use the right one and not to paste both versions on by accident :)

27 posts
  • Belgium
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 100 and 1 000 dollars
Grafik_fighter says

thank’s for this help…

1 post
  • Has been a member for 5-6 years
  • Sold between 100 and 1 000 dollars
  • United Kingdom
martinkorner says

Thanks Ziyad :)

by
by
by
by
by