marconiduarte / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Enhancement suggestion: Allow swfobject parameters to be passed as single JS object #237

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to be able to pass parameters to swfobject as a single
JavaScript object. For example, instead of this:

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0",
"expressInstall.swf", {flashvar:"value"}, {param:"value"},
{attribute:"value"});

Do this:

var swfParamsObject = {
    "myContent": {
        swfUrl: "myContent.swf",
        width: "300",
        height: "120",
        version: "9.0.0",
        expressInstallSwfurl: "expressInstall.swf",
        flashvars: {flashvar:"value"},
        params: {param:"value"},
        attributes: {attribute:"value"}
    }
};
swfobject.embedSWF(swfParamsObject);

If there were more than one object inside swfParamsObject ("myContent",
"myContent2", etc.), it would run embedSWF for each of these.

Why I want this: This would allow me to assemble the swfParamsObject in my
server-side language, like PHP, and use its build-in JSON serialize
function to create the JS object. That way, the JSON serialize function
takes care of the escaping of the values.

This could also be useful in highly dynamic environments. One could easily
update the swfParamsObject and call embedSWF on it again to load a
different set of movies.

Original issue reported on code.google.com by liam.mor...@gmail.com on 12 Dec 2008 at 6:03

GoogleCodeExporter commented 9 years ago
You could write your own wrapper for this, we will not change the current API 
in the
near future, however only extend it.

Original comment by bobbyvandersluis on 12 Dec 2008 at 7:46

GoogleCodeExporter commented 9 years ago
This could be done as an extension to the API. embedSWF could check if its first
argument is an object. If so, it would operate as I suggest. If not, it would 
operate
like it does now.

Original comment by liam.mor...@gmail.com on 12 Dec 2008 at 9:56