- 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, "" "," "", "10.0.0", "./swf/ Expressinstall.swf ", flashvars,params);
- }
- Embswfwithurl (' http://xxx.com/xxx.html ', ' Swfcon '); Here the http://xxx.com/xxx.html returns the data in the corresponding JSON format.
Copy CodeSwfcon is a div container that puts Flash. SWFObject is the open source JS processing Flash class: http://code.google.com/p/swfobject/ Note: There are two ways Flash chart obtains data, one for Data-file and the other for Get-data. Data-file just like the example above, the value must be a URL address, which returns JSON data. The value of Get-data is a function name. The function returns the JSON data. Example:
- Get-data
- function Embswfwithdata (DIVCON,GETDATAFN) {
- var params = {
- "Wmode": "Transparent",//Window mode
- "Menu": "false",//Menu display
- "Scale": "Noscale",//Zoom
- "allowFullScreen": "false",//Allow Fullscreen
- "allowScriptAccess": "Always",//Allow script
- "bgcolor": "#c0c0c0"//Background
- };
- var Flashvar = {
- "Get-data": Getdatafn
- };
- swfobject.embedSWF ("/swf/open-flash-chart.swf?timestamp=" + math.random (), Divcon, "" "," "," "Ten", "/swf/ Expressinstall.swf ", Flashvar, params);
- }
- function Getjsondata () {
- Return ' JSON data ';
- } here "Get-data": Getdatafn
Copy Code |