Skip to main content
Participant
March 7, 2008
Question

Passing data from php to flash

  • March 7, 2008
  • 4 replies
  • 522 views
I am creating a quiz program. For this i get the loginid in my php page and i hav linked to a page where i hav embeded my quiz.swf file... after the quiz i display the marks in my movie itself and i sucessfully passed the marks to my php. Now the prob is i hav to get the corresponding loginid also with my marks so tat i can store them in a database. is there any way to pass the corresponding loginid to the quiz.swf??


Can anyone plase help me ? I am using flash 8.
Thanks in advance
This topic has been closed for replies.

4 replies

ronytomAuthor
Participant
March 7, 2008
Thank u so much Mr.lilalfyalien.... The tutorial helped me

Now wen i run from flash, i get a seperate window called output and in tat i get "Variables Loaded"

Now wat i want is i should display the values in the variable in my movie itself. For that i think i should use dynamic text.

Can u please explain that step and also the corresponding actionscript???

Thanks in advance
Inspiring
March 7, 2008
Also, look at embedding your movie using SWFObject, it allows you to easily
pass variables from PHP into your movie.
http://blog.deconcept.com/swfobject/


--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


ronytomAuthor
Participant
March 7, 2008
I am tring to just pass the variables from php and display them in flash

My php code:
<?php
$firstname="Rony";
print "firstname=$firstname";
?>

In flash i hav a dynamic text field with the variable name as "firstname"

My actionscript:
loadVariablesNum("nameofphp.php", 0);
firstname.txt = firstname;

But i get nothing when i run my swf.Both the files are in the same location.Can anyone please help?

Thanks in advance
Participating Frequently
March 7, 2008
Are you loading this through the Flash IDE or testing it live? This tutorial seems to be doing exactly what you want to do: How to use LoadVars Tutorial

It could also be that you have to do something the fact that you're not "swonking"- you have to wait for Flash to finish loading the data in, otherwise you essentially end up calling a method on said data before it's loaded as Flash doesn't perform a method/function and then wait it will carry on- which I expect is happening to you. Look at the tutorial above, it shows you how to combat this problem by creating a delegate function which will wait for your data and then try to use.
Participating Frequently
March 7, 2008
Do a google search on LoadVars() tutorial...