手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >页面调用单个swf文件,嵌套出多个方法。
页面调用单个swf文件,嵌套出多个方法。
摘要:HTML端:PART1:复制代码代码如下:{{foreachfrom=$question.question_itemitem="it"nam...

HTML 端:

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" value="{title:{{$it.item_name}},vote:12票,proportion:0.25,singleId:swfdv{{$key+1}}}"/></td>

</tr>

{{/foreach}}

PART 2:

复制代码 代码如下:

<div></div>

<div id="swfdv{{$key+1}}"></div>

<input type="hidden" 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文件,嵌套出多个方法。】相关文章:

JavaScript对表格或元素按文本,数字或日期排序的方法

jQuery实现给页面换肤的方法

jQuery实现首页图片淡入淡出效果的方法

js比较日期大小的方法

Javascript中prototype属性实现给内置对象添加新的方法

解析Node.js基于模块和包的代码部署方式

jQuery实现将页面上HTML标签换成另外标签的方法

无刷新上传文件并返回自定义值

详解AngularJS中$http缓存以及处理多个$http请求的方法

js禁止页面刷新与后退的方法

精品推荐
分类导航