HTML End:
Part 1:
Copy Code code as follows:
{{foreach from= $question. Question_item item= "It" Name= "Question_item"}}
<tr>
<TD align= "left" >{{$it .item_id}}</td>
<TD align= "left" >{{$it .item_name}}</td>
<TD align= "left" >9
<input type= "hidden" class= swfhdn "value=" {title:{{$it. Item_name}},vote:12 ticket, proportion:0.25,singleid:swfdv{{$ Key+1}}} "/></td>
</tr>
{{/foreach}}}
Part 2:
Copy Code code as follows:
<div style= "width:190px; height:10px; Background-color: #FFF; Float:left; " ></div>
<div id= "swfdv{{$key +1}}" class= "Swfarea" ></div>
<input type= "hidden" class= "Swfquescount" value= "{{$key +10}}"/>
JS file:
Copy Code code as follows:
function createswf (swfhome,swfheight)
{
if (Swfobject.hasflashplayerversion ("9"))
{
var flashvars = {};
Flashvars.quesid = Swfhome;
swfobject.embedSWF ("swf/statistic2.swf", Swfhome, "520", Swfheight, "9", "", flashvars);
}
}
var arymsg = new Array ();
function Resultarray () {return arymsg;}
function init ()
{
var ary = $ (". Swfhdn");
for (j = 0; j< ary.length; j + +)
{
Arymsg.push (Ary[j].value);
}
var aryswf = $ (". Swfarea");
for (i = 0; i < aryswf.length; i++)
{
var swfheight = $ (". Swfquescount") [I].value * 18 + 3;
Createswf (Aryswf[i].id.tostring (), swfheight.tostring ());
}
}
FLEX End:
Copy Code code as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<mx:application xmlns:mx= "Http://www.adobe.com/2006/mxml"
layout= "Absolute" backgroundcolor= "0XFFFFFF"
verticalscrollpolicy= ' off ' horizontalscrollpolicy= ' off '
Creationcomplete= "Application1_creationcompletehandler (event)" >
<mx:vbox id= "CVS" y= "2" width= "100%" height= "100%" verticalgap= "5"/>
<mx:Script>
<! [cdata[
Import Com.flexlib.moudel.statistical.StatisticalService;
Import Com.flexlib.moudel.statistical.StatisticalBar;
Import Com.flexlib.moudel.statistical.StatisticalPane;
Import mx.events.FlexEvent;
private var res:statisticalservice = new Statisticalservice ();
Public Function Statisticalmanager (ary:array): void
{
var bar:statisticalbar = new Statisticalbar ();
Bar.width = 350;
Bar.height = 15;
Bar.accurate = 1;
Bar.color = 0x9999ff;
var pane:statisticalpane = new Statisticalpane ();
Pane.width = 520;
Pane.height = 15;
Pane.titlespace = 50;
Pane.votespace = 35;
Pane.barspace = 25;
Pane.percentspace = 60;
Res.dataarray = ary;
Res.autocolorenabled =true;
Res.geostrophyenabled = true;
Res.geostrophy = [0XFFFFFF,0XCCCCCC];
Res. Statisticallist (PANE,BAR,CVS);
}
protected function Application1_creationcompletehandler (event:flexevent): void
{
var item:object = Application.application.parameters;
var arymsg:object = Externalinterface.call ("Resultarray");
var strtmp:string;
var newary:array = new Array ();
for (var i:int = 0; i < arymsg.length; i++)
{
strtmp = arymsg[i].substring (Arymsg[i].indexof ("Singleid:") + 9,arymsg[i].length-1);
if (strtmp = = Item.quesid) {Newary.push (arymsg[i]);}
}
Statisticalmanager (newary);
}
]]>
</mx:Script>
</mx:Application>