Javascriptに基づくFlashメディアバージョンの検出と埋め込みモジュール


SWFObject:   Javascript Flash           



    

SWFObject         ,      swfobject.js  js  ,   DOM        JS  ,    Flash     。            :

<script type="text/javascript" src="swfobject.js"></script>
		
<div id="flashcontent">
  This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
   var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
   so.write("flashcontent");
</script>
               

<div id="flashcontent">[...]</div>
  ,    SWF      HTML  。  HTML               Flash    ,        Flash      ,         。     SEO              。

var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);
      SWFObject  ,        :

swf - SWF    
id -     SWF     id ,     embed object    name  ,       swliveconnect   ,       
width -   
height -   
version - FlashPlayer      ,       '    .    .  ',  :"6.0.65"。   ,           ,  :"6"。
background-color - Flash      ,16    
  ,        :

quality -     ,   "high"。
xiRedirectUrl -   ExpressInstall  
redirectUrl -                       
detectKey -         ,SWFObject  url        ,    “detectflash”,       
so.write("flashcontent");
 Flash     DOM ,        。

  

SWFObject        。         HTML     ,         Flash  。            Flash    ,        ;           ,           。                    

SWFObject           , :PC  IE5/5.5/6, Netscape 7/8,Firefox, Mozilla, and Opera。Mac  IE5.2, Safari, Firefox, Netscape 6/7, Mozilla, and Opera 7.5+,                

SWFObject  Flash      3         ,      IE “  ”   。       。

SWFObject           ,      v.6.0 r65 (or 6,0,65,0)    SWF  ,         :

var so = new SWFObject("movie.swf", "mymovie", "200", "100", "6.0.65", "#336699");
SWFObject           。            SWFObject     ,            HTML   ,    。SWFObject              ,    Flash     DOM 。             “detectflash”,       :

<a href="mypage.html?detectflash=false">Bypass link</a>
SWFObject   

               ,             ,       、             。

  Flash         

<script type="text/javascript">
   var so = new SWFObject("movie.swf", "mymovie", "200", "100%", "7", "#336699");
   so.addParam("quality", "low");
   so.addParam("wmode", "transparent");
   so.addParam("salign", "t");
   so.write("flashcontent");
</script>
      Flash         :full list of the current parameters and their possible values(adobe.com    )

  "Flashvars"      

 Flashvars     Flash          ,     GET       , :variable1=value1&variable2=value2&variable3=value3SWFObject               

<script type="text/javascript">
   var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
   so.addVariable("variable1", "value1");
   so.addVariable("variable2", "value2");
   so.addVariable("variable3", "value3");
   so.write("flashcontent");
</script>
         _root  MovieClip   。

SWFObject         URL       Flash ,        URL:http://www.example.com/page.html?variable1=value1&variable2=value2。  getQueryParamValue()              ,      Flash,  :

<script type="text/javascript">
   var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
   so.addVariable("variable1", getQueryParamValue("variable1"));
   so.addVariable("variable2", getQueryParamValue("variable2"));
   so.write("flashcontent");
</script>
getQueryParamValue()        JavaScript Location   hash “location.hash”  swf      。       SWFObject     ,     location.hash  :    

 SWFObject   Express Install(          )

SWFObject    AdobeFlash          ( 6.0.65  FlashPlayer   swf      !),                         。

  ,     expressinstall.swf       ,    useExpressInstall      swf         ,  :

<script type="text/javascript">
	   var so = new SWFObject("movie.swf", "mymovie", "200", "100", "8", "#336699");
	   so.useExpressInstall('expressinstall.swf');
	   so.write("flashcontent");
	</script>
           Flash               

 SWFObject                   ,       ExpressInstall   。

    Flash        ,           ExpressInstall         ,     xiRedirectUrl  ,         。  :

<script type="text/javascript">
   var so = new SWFObject("movie.swf", "mymovie", "200", "100", "8", "#336699");
   so.useExpressInstall('expressinstall.swf');
   so.setAttribute('xiRedirectUrl', 'http://www.example.com/upgradefinished.html'); // must be the absolute URL to your site
   so.write("flashcontent");
</script>
  

SWFObject  MIT License,         。

   SWFObject 1.5 - Zip   ,    swfobject.js      。

    :

  Flash   -   XHTML 1.0 Strict.*
  Flash   -   XHTML 1.0 Strict.*
 Express Install   Flash   -  6.0.65  FlashPlayer      
*       text/html  ,   application/xhtml+xml.

             :SWFObject  !

    

    ,     Flash             ,          。                      。

1) Adobe    

      Object   Embed      ,          :

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
   codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" 
   width="550" height="400" id="Untitled-1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="mymovie.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="mymovie.swf" quality="high" bgcolor="#ffffff" width="550" 
   height="400" name="mymovie" align="middle" allowScriptAccess="sameDomain" 
   type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
           ,        。

                     ,            ,             ActiveX      ,            。  ,             swf  ,         ,                
Eolas      IE             “  ”        Flash     。    
   XHTML   -  HTML XHTML    embed  HTML or XHTML。  object              ,      embed         。
2)    Object   / Flash satay

     2002  A List Apart article           ,       :

'  Object  '

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
   codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
   width="300" height="120">
 <param name="movie" value="http://www.macromedia.com/shockwave/download/triggerpages_mmcom/flash.swf"> 
 <param name="quality" value="high">
 <param name="bgcolor" value="#FFFFFF">
 <!--[if !IE]> <-->
 <object data="http://www.macromedia.com/shockwave/download/triggerpages_mmcom/flash.swf"
		 width="300" height="120" type="application/x-shockwave-flash">
  <param name="quality" value="high">
  <param name="bgcolor" value="#FFFFFF">
  <param name="pluginurl" value="http://www.adobe.com/go/getflashplayer">
  FAIL (the browser should render some flash content, not this).
 </object>
 <!--> <![endif]-->
</object>
Flash satay

<object type="application/x-shockwave-flash
data="c.swf?path=movie.swf" 
width="400" height="300">
<param name="movie" 
value="c.swf?path=movie.swf" />
<img src="noflash.gif" 
width="200" height="100" alt="" />
</object>
      -    Flash Satay   ,           swf  .
Eolas      IE             “  ”        Flash     。    
                     ,            ,             ActiveX      ,            。  ,             swf  ,         ,                
    Safari   param   -      :2.0 (Tiger)    1.3 (Panther)      1.2.8 ( Panther)   ,Safari     param   。      Flashvars       。
3) 'small flash movie on the index page'     

             swf     $version          。

    :

      -          swf     
“  ”  
   HTML  XHTML  
          
4) Adobe   Flash Player Detection   

Adobe          ,         ,          

Flash    ,      "small Flash movie on the index page" -        
Javascript -         HTML        
       。

5)     JS   、  

         ,        ,        

       -           Flash      ,           
          -      DOM  
        - SWFObject       ,