Reputation: 1734
I am making a audio flash player which will play a sound passed to it.
How can i pass the values from a browser url?
like i have to write
http://domain/folder1/folder2/player.swf?file=http://domain/folder1/folder3/mymp3file.mp3
in browser and swf will parse it to play the file from the location passed as GET parameter 'file'. How i can do it in as i am using Adobe Flash CS4 Professional with actionscript 3.0
Any help or idea or link to this will be highly appreciated.
Upvotes: 1
Views: 938
Reputation: 28349
the embed tag that flash generates (which puts the player into your page) has a param called flashvars that you can pass whatever arguments you want to, and then collect them within the movie from root.environment.
So... it's a 3 step process
1) grab the variable from the query string with javascript...
var myVal = document.location.query.substring(1);//this removes the '?'from the front
then follow the directions in the link below for the last 2 steps.
2) write it with javascript into the flashvars param of the embed tag in the html
3) collect and use the variable inside of flash
This http://kb2.adobe.com/cps/164/tn_16417.html link explains it with details
Upvotes: 1
Reputation: 46137
You can use FlashVars
to pass the parameters along to your AS classes in your application. See this article - http://kb2.adobe.com/cps/164/tn_16417.html - on working with FlashVars.
Upvotes: 1