-
-
- //url form
- function embSwfWithUrl(dataurl,divcon){
- var params = {
- "wmode": "transparent",
- "menu": "false",
- "scale" : "noScale",
- "allowFullscreen": "false",
- "allowScriptAccess": "always",
- "bgcolor": "#c0c0c0" //Background
- };
- var flashvars = {
- 'data-file' : dataurl
- };
- swfobject.embedSWF("/swf/open-flash-chart.swf?timestamp=" + Math.random(),divcon, "450", "300", "10.0.0", "./ swf/expressInstall.swf",flashvars,params);
- }
- embSwfWithUrl('http://xxx.com/xxx.html','swfCon');http://xxx.com/xxx.html here returns is the corresponding data in json format.
-
Copy code
swfCon is a div container for flash.
swfobject is an open source js class for processing flash: http://code.google.com/p/swfobject/
Note: There are two ways to obtain data from flash chart,
One is data-file and the other is get-data.
data-file is just like the above example, the value must be a url address, and the json data returned inside.
The value of get-data is a function name. The function returns json data.
Example:
-
-
- //get-data
- function embSwfWithData(divcon,getdataFn){
- var params = {
- "wmode": "transparent", //Window mode
- "menu": "false ", //Menu display
- "scale": "noScale", //Scale
- "allowFullscreen": "false", //Allow full screen
- "allowScriptAccess": "always", //Allow script
- "bgcolor": " #c0c0c0" //Background
- };
- var flashVar = {
- "get-data":getdataFn
- };
- swfobject.embedSWF("/swf/open-flash-chart.swf?timestamp=" + Math.random( ), divcon, "450", "300", "10", "/swf/expressInstall.swf",flashVar ,params);
- }
- function getJsonData(){
- return 'json data';
- }Here "get -data”:getdataFn
Copy code
|