开发者

Flash player passing values from url as GET method

开发者 https://www.devze.com 2023-04-05 20:34 出处:网络
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?

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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号