about _页面调用单个swf 文件,嵌套出多个方法。
2011-09-29 18:05
295 查看
HTML 端:
JS 文件:
FLEX 端:
PART 1: {{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票,proportion:0.25,singleId:swfdv{{$key+1}}}"/></td> </tr> {{/foreach}} PART 2: <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 文件:
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 端:
<?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>
相关文章推荐
- 页面调用单个swf文件,嵌套出多个方法。
- html页面调用js文件里的函数报错onclick is not defined处理方法 (click)
- html静态页面调用php文件的方法
- C#编译器优化那点事 c# 如果一个对象的值为null,那么它调用扩展方法时为甚么不报错 webAPI 控制器(Controller)太多怎么办? .NET MVC项目设置包含Areas中的页面为默认启动页 (五)Net Core使用静态文件 学习ASP.NET Core Razor 编程系列八——并发处理
- 在CS类文件里向调用页面输出Javascript代码的3种方法
- 在APP中嵌套H5页面,点击页面上的按钮调用app的组件方法
- [转]html页面调用js文件里的函数报错onclick is not defined处理方法
- iOS网络 POST模拟表单上传单个与多个文件(直接调用分类里的方法即可)
- html静态页面调用php文件的方法
- 在CS类文件里向调用页面输出Javascript代码的3种方法
- IOS UIWebView调用H5页面后退方法出现“about:blank”
- 在aspx页面里调用cs后台文件里的方法,返回结果到aspx页面
- 把js文件编译成dll供页面调用的方法
- 每个 GROUP BY 表达式必须至少包含一个不是外部引用的列、加载页面时调用Js方法、调用Js文件中的方法
- 每日总结:每个 GROUP BY 表达式必须至少包含一个不是外部引用的列、加载页面时调用Js方法、调用Js文件中的方法
- 在Ajax1.0中调用页面CS文件中的方法
- 把js文件编译成dll供页面调用的方法
- jsp页面:js方法里嵌套java代码(是操作数据库的),如果这个js 方法没被调用,当jsp页面被解析的时候,不管这个js方法有没有被调用这段java代码都会被执行?
- 单个页面显示多个Ueditor编辑器方法