Hey,
I want to use a flash move as a sound player. I need to have about 5 to 10 instances of the movie per page and want to know if there is any way to specify what sound clip that a specific instance of this flash movie will play in the HTML?
| SitePoint Sponsor |
Hey,
I want to use a flash move as a sound player. I need to have about 5 to 10 instances of the movie per page and want to know if there is any way to specify what sound clip that a specific instance of this flash movie will play in the HTML?

Hey,
Sure, there are these ways -
1. Append variables to the filename of the movie in the object and embed tags.
e.g index.swf?musicloop=3.mp3
In ActionScript this will be available as _root.musicloop
This is Flash Player 5 and 6 compatible
2. Use the flashVars parameter
MM technote
http://www.macromedia.com/support/fl.../flashvars.htm
HTH
James
Originally Posted by webQS
What about sending variables from flash to html or php???? how to write them to disk in a text file (for example i have the msg variable and i want to save it to msg.txt. How do i do that???)

Hey
Writing to a text file using Flash and PHP would involve using loadVars (or loadVariables) to send the required variables to a script.
myVars = new LoadVars();
myVars.msg = "hello world";
myVars.sendAndLoad("script.php", receivingObject, POST);
Then use the php filesystem functions to write to the text file.
On a successful write, send a variable from PHP back to Flash
e.g echo "&result=ok";
Which will turn up in "receivingObject" as receivingObject.result
Sending to HTML requires the use of Javascript and possibly some fscommands. Bear in mind this doesn't work on IE for Mac.
HTH
james
Originally Posted by d3m





WebQS, in the sendAndLoad method, don't you have to specify the transfer method in quotes?
ie
"POST"
or
"GET"
otherwise it looks for a variable with that name. Am I mistaken?

Aaron -
Not sure, the manual has this
loadVariables("http://www.mySite.com/scripts/high_score.php", _root.scoreClip, GET);
but it also recommends something like this, as does Moock's book.
loadVariables("http://www.mySite.com/scripts/high_score.php", _root.scoreClip, "GET");
Maybe I'll do a test script and check my log files to see how the document loaded was handled by the server.
cheers
James





Cool, let me know how it goes. The book I'm using only showed the quotes around it. I guess flash's inate AS script processer would know that either a GET or POST can be there, so maybe it doesn't need quotes.. *shrugs*
Bookmarks