send a Param to a SWF

3 posts (showing 1-3)
Lord_Garland

Market Level 4Community Level 9
1873 posts

I'm trying to send a Param to a SWF that is loaded via Action Script 3.

Below is the HTML code that normally loads the swf.

I need to load it in AS3.

If anyone could solve this that would be a life saver.

<!DOCTYPE html>
<html>
<body>
<object id="flowplayer" width="300" height="200"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf"
type="application/x-shockwave-flash">
 
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf" />
<param name="allowfullscreen" value="true" />
 
<param name="flashvars"
value='config={"clip":"http://stream.flowplayer.org/N8inpasadena-Flowers457.flv"}' />
</object>
</body>
</html>


posted 2015-04-16T03:41:51-07:00
FGL_Dave

FGL AdminCommunity Level 4
304 posts

Have you checked out this page?

https://helpx.adobe.com/flash/kb/pass-variables-swfs-flashvars.html

The example they give looks like this:

[as3]
// by querying the LoaderInfo object, set the value of paramObj to the
// to the value of the variable named myVariable passed from FlashVArs in the HTML
var paramObj: Object = LoaderInfo(this.root.loaderInfo).parameters.myVariable;
 
// set the text of the text instance named text1. Use the toString() method
// to convert the value from an object to a string so it can be used in the text field
text1.text = paramObj.toString()[/as3]

Your config variable there is JSON-encoded, so you may need to parse it using JSON.parse before using the variable, or simply provide the variable like so:

[as3]
<param name=FlashVars value="clip=
http://stream.flowplayer.org/N8inpasadena-Flowers457.flv" />[/as3]

Also, make sure you're using "FlashVars" and not "flashvars"!

posted 2015-04-16T04:31:55-07:00 | edited 2015-04-16T04:33:53-07:00
Lord_Garland

Market Level 4Community Level 9
1873 posts

I got it. 

Thanks dave. I just came back to say I got it worked out.

FGL is the BEST!!!!

posted 2015-04-16T05:01:01-07:00