swfObject 使用说明
2014-03-29 10:33
369 查看
1.Embed your SWF with JavaScript
使用方法 swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes, callbackFn) 包含5个必须参数及5个可选参数。swfUrl (String, required) specifies the URL of your SWF id (String, required) specifies the id of the HTML element (containing your alternative content) you would like to have replaced by your Flash content width (String, required) specifies the width of your SWF height (String, required) specifies the height of your SWF version (String, required) specifies the Flash player version your SWF is published for (format is: "major.minor.release" or "major") expressInstallSwfurl (String, optional) specifies the URL of your express install SWF and activates Adobe express install. Please note that express install will only fire once (the first time that it is invoked), that it is only supported by Flash Player 6.0.65 or higher on Win or Mac platforms, and that it requires a minimal SWF size of 310x137px. flashvars (Object, optional) specifies your flashvars with name:value pairs params (Object, optional) specifies your nested object element params with name:value pairs attributes (Object, optional) specifies your object's attributes with name:value pairs callbackFn (JavaScript function, optional) can be used to define a callback function that is called on both success or failure of creating a Flash plug-in <object> on the page (see API documentation)
注意:可选的参数你可以忽略,或者给它传递false值即可,对于flashvars,params,attributes参数,你也可以传递空对象{}.
2.How can you configure your Flash content?
你可以为attributes 对象指定如下可选的属性:id (NOTE: when undefined, the object element automatically inherits the id from the alternative content container element) align name styleclass (see note about class) class
styleclass 与class 都是指定样式,但因为class是js中的关键字,所以如果使用class时要用引号括起来。 Example:
var attributes = { id: "myId", align: "left", styleclass: "myclass" };
If you would rather use class instead of styleclass, wrap the word class in quotes like this:
var attributes = { id: "myId", align: "left", "class": "myclass" };
你还可以为params对象指定如下可选的属性:
play
loop
menu
quality
scale
salign
wmode
bgcolor
base
swliveconnect
flashvars
devicefont (more info)
allowscriptaccess (more info here and here)
seamlesstabbing (more info)
allowfullscreen (more info)
allownetworking (more info)
3.你可以忽略flashvars参数,而使用params对象的flashvars属性指定:
<script type="text/javascript"> var flashvars = false; var params = { menu: "false", flashvars: "name1=hello&name2=world&name3=foobar" }; var attributes = { id: "myDynamicContent", name: "myDynamicContent" }; swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes); </script>
官方文档:https://code.google.com/p/swfobject/wiki/documentation
属性参数值配置:http://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html
使用flashvars参数传值到swf:http://helpx.adobe.com/flash/kb/pass-variables-swfs-flashvars.html
相关文章推荐
- SWFObject 2.0的使用说明
- SWFObject 2.0的使用说明
- SWFObject 2.0的使用说明
- SWFObject 的原站提供的使用说明
- Valgrind使用说明
- NSURLSession使用说明及后台工作流程分析
- Visual C++内存泄露检测—VLD工具使用说明
- Linux系统下安装rz/sz命令及使用说明
- svn命令行使用说明
- jstl标签fn:substring使用技巧 和 JSTL中fn表达式的使用说明
- 联想教育应用使用说明(7.6版本)——第0章 目录
- linux find命令-exec参数的使用说明(笔记)
- jsp内置对象 的使用范围和类型【说明】
- iOS 使用UIBezierPath绘制圆型, 并且根据半径, 角度, 长度在圆外任意一点绘制线段, 通常用于饼状图的文字说明
- Bugzilla的使用说明
- 代码说明生成工具doxygen的使用
- Python中关于导入(import)语句的使用说明
- Hiernate各个版本使用说明
- SVN客户端使用说明
- phpcms v9中模板标签使用说明