HTML 端: PART 1:
{{foreach from=$question.question_item item="it" name="question_item"}}
{{$it.item_id}} {{$it.item_name}} 9
{{/foreach}}
PART 2:
JS 文件:
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{ aryMSG.push(ary[j].value); } var arySWF = $(".swfarea"); for(i = 0; i { var swfheight = $(".swfQuesCount")[i].value * 18 + 3; createSWF(arySWF[i].id.toString(),swfheight.toString()); } }
FLEX 端:
layout="absolute" backgroundColor="0xffffff" verticalScrollPolicy="off" horizontalScrollPolicy="off" creationComplete="application1_creationCompleteHandler(event)"> <script> <br>import com.flexlib.moudel.statistical.StatisticalService; <br>import com.flexlib.moudel.statistical.StatisticalBar; <br>import com.flexlib.moudel.statistical.StatisticalPane; <br>import mx.events.FlexEvent; <br>private var res:StatisticalService = new StatisticalService(); <br>public function StatisticalManager(ary:Array):void <br>{ <br>var bar:StatisticalBar = new StatisticalBar(); <br>bar.width = 350; <br>bar.height = 15; <br>bar.accurate = 1; <br>// bar.color = 0x9999ff; <br>var pane:StatisticalPane = new StatisticalPane(); <br>pane.width = 520; <br>pane.height = 15; <br>pane.titleSpace = 50; <br>pane.voteSpace = 35; <br>pane.barSpace = 25; <br>pane.percentSpace = 60; <br>res.dataArray = ary; <br>res.autoColorEnabled =true; <br>res.geostrophyEnabled = true; <br>res.geostrophy = [0xffffff,0xcccccc]; <br>res.StatisticalList(pane,bar,cvs); <br>} <br>protected function application1_creationCompleteHandler(event:FlexEvent):void <br>{ <br>var item:Object = Application.application.parameters; <br>var aryMSG:Object = ExternalInterface.call("resultArray"); <br>var strtmp:String; <br>var newAry:Array = new Array(); <br>for(var i:int = 0; i { <br>strtmp = aryMSG[i].substring(aryMSG[i].indexOf("singleId:") + 9,aryMSG[i].length - 1); <br>if(strtmp == item.quesID){ newAry.push(aryMSG[i]); } <br>} <br>StatisticalManager(newAry); <br>} <br>]]> <br></script>