ActionScript 3 如何在网站上安装swf

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 如何在网站上安装swf相关的知识,希望对你有一定的参考价值。

About how to install swf files in your website,here have some method for you to choose.

Method 1:

Add js code in <head> ... </head>:

<script type="text/javascript" src="swfobject/swfobject.js"></script>

Add div code for load swf file in <body> ... <body>:

<div id="preview_div">
                <script type="text/javascript">
                    <!--
                    var flashvars = {                    
                };
            var params = {
                    scale: "noscale",
                    menu: "false",
                    bgcolor: "#000000"
                };                  
                    var attributes = {
                    id: "preview_swf",
                                name: "preview_swf"
                };          
                    swfobject.embedSWF("preview.swf", "preview_div", "590", "300", "9", "swfobject/expressInstall.swf", flashvars, params, attributes);
                    //-->
                </script>
        </div>

If you use the method,you need notice the xml file path.For example:

index.html -> xmlbaner.swf
            the swf files and the xml must the same path like load index path.
service path files like
            root/ index.html
            root/ xmlbanner.swf
            root/ data.xml
            root/ image/...

Method 2:

<div id="preview_div">
                    <iframe src="preview.swf " width="590" height="300" scrolling="no" frameborder="0" style="float:left; width:590px;">
iframe>
 </div>

If you need the method,you don't worry the xml files path.

Method 3:

Add js code in <head> ... </head>:

<script src="js/AC_RunActiveContent.js" language="javascript"></script>

Add div code for load swf file in <body> ... <body>:

<div id="preview_swf">
                   <script language="javascript">
                        if (AC_FL_RunContent == 0) {
                            alert("This page requires AC_RunActiveContent.js.");
                        } else {
                            AC_FL_RunContent(
                            'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                            'width', '590',
                            'height', '300',
                            'src', 'preview',
                            'quality', 'best',
                            'pluginspage', 'http://get.adobe.com/flashplayer/',
                            'align', 'middle',
                            'play', 'true',
                            'loop', 'true',
                            'scale', 'showall',
                            'wmode', 'window',
                            'devicefont', 'false',
                            'id', 'preview',
                            'bgcolor', '#000000',
                            'name', 'preview',
                            'menu', 'true',
                            'allowFullScreen', 'false',
                            'allowScriptAccess','sameDomain',
                            'movie', 'preview',
                            'salign', ''
                            ); //end AC code
                    }
                </script>
                <noscript>
                    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553541111" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="590" height="300" id="preview" align="middle">
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="allowFullScreen" value="false" />
                    <param name="movie" value="preview.swf" />
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#000000" />   
                    <embed src="preview.swf" quality="high" bgcolor="#000000" width="590" height="300" name="preview" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com/flashplayer/" />
                    </object>
                </noscript>
        </div>

If you use the method,you need notice the xml file path.For example:

index.html -> xmlbaner.swf
            the swf files and the xml must the same path like load index path.
service path files like
            root/ index.html
            root/ xmlbanner.swf
            root/ data.xml
            root/ image/...
From: http://activetofocus.com/blog/how-to-install-swf-in-website-28/

以上是关于ActionScript 3 如何在网站上安装swf的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 检测是从网站还是从硬盘驱动器上的文件加载swf

ActionScript 3 如何将重点放在UIComponent上

如何使用 Actionscript 3 为在 z 轴上弹跳的球设置动画?

Actionscript 3如何一次移动多个对象而没有延迟

在舞台上有多个玩家 actionscript 3.0 php MySQL

Actionscript 3.0 - 检测已放置在舞台上的多个实例并将它们添加到数组中