Heim > Web-Frontend > js-Tutorial > Hauptteil

页面调用单个swf文件,嵌套出多个方法。_javascript技巧

WBOY
Freigeben: 2016-05-16 17:59:12
Original
1025 Leute haben es durchsucht

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>

Verwandte Etiketten:
swf
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage