views:

511

answers:

4

Hi,

i got code like this:

swfobject.embedSWF("/Content/open-flash-chart.swf", 
                   "my_chart", 
                   "750", 
                   "300",
                   "9.0.0", 
                   "expressInstall.swf",
{"data-file":"http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456"}
);

The outcome is, that a request is always made without any additional parameter, except for the first one.. so the request looks like this:

http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123

Any ideas why all other parameters are not used? I would at least expect some damaged parameter in the call, but it's simply cut away.

Thank you

A: 

Hi,

Did you try switching the parameters around to see if you get the same outcome? There could be an issue with encoding. It may help if you list some of the actual parameters that are being used.

Knix
David
It does not look like you are using variables here. Try using single quotes.
Knix
A: 

You need to url-encode the flashvars that you pass to swfobject -- so url-encode the whole data-file url (after you url-encode any of the individual params in the url as necessary):

{"data-file": encodeURIComponent("/mydata?q=" + encodeURIComponent(x) + "&p=" + encodeURIComponent(y))}

See http://teethgrinder.co.uk/open-flash-chart-2/tutorial-3.php

Justin Ludwig
+1  A: 

As mentioned in the open flash chart tutorial 3 section entitled "Stop! And Read This..." you absolutely must url encode the parameters being passed into swfobject.

You can do this as follows in your script:

swfobject.embedSWF("/Content/open-flash-chart.swf", 
               "my_chart", 
               "750", 
               "300",
               "9.0.0", 
               "expressInstall.swf",
{"data-file": encodeURIComponent("http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456")}
);

You need to make sure to encode all values you pass to swfobject, so make sure to add the encode to any you add in the future.

Cheers.

coderjoe
A: 

Hello, unless there is a input mistake on your count you should remove the quotes around your variable name.

//not this
{"data-file":"http://localhost:8803/"}

//this
{dataFile:"http://localhost:8803/"}

Lemme know if this works for you.

EDIT

Whoops! didn't read that properly, yes always url encode the params.