Return to Snippet

Revision: 38895
at January 9, 2011 21:28 by activetofocus


Initial Code
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/

Initial URL
http://activetofocus.com/blog/how-to-install-swf-in-website-28/

Initial Description
Great

Initial Title
How to install swf in website

Initial Tags


Initial Language
ActionScript 3