swfobject的用法Html中嵌入Flashswf

mac2022-06-30  27

官方网址介绍http://code.google.com/p/swfobject/wiki/documentation

用法:html部分<div id="swf1">......</div>js部分   swfobject.embedSWF("test.swf", "swf1", "300", "120", "9.0.0",);

源码部分:这是2.2中的源码。看参数就明白怎么使用了。embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {

....}

详解首先需要了解object标签。http://www.w3school.com.cn/tags/tag_object.asphttp://www.w3school.com.cn/tags/tag_param.aspswfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr这些依次为,swf位置,html要替换成flash的元素的id,宽,高,flash版本,如果没有flash那就使用这个自动安装flash的文件 swfobject2.2源文件里有

flashvarsObj:这里是flashvars的值。这个常用来作为html与flash之间传递参数,本来是在params对象中的属性,由于考虑到常用和方便,所以单独取了出来。可以设置为null。然后在param中写。param对象的属性:详细的介绍http://kb2.adobe.com/cps/127/tn_12701.htmlplay,loop,menu,quality,scale,salign,bgcolor,base,swliveconnect,flahvars,devicefont ,allowscriptaccess ,seamlesstabbing ,allowfullscreen ,allownetworkingwmode     这个很重要,window,opaque,transparent(一般设为transparent透明或者opaque不透明)。当不设置时默认为window,这时已窗口方式呈现。这时object元素将始终显示在最上面,同时点击事件等也监听不到。attributes对象的属性:id,name,styleclass(不使用class,因为class也是ECMA4的保留关键字),align

callbackFn:回调函数

转载于:https://www.cnblogs.com/x38160/p/3175844.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)