close panorama

Embedding into HTML

For embedding a flash object into a HTML site there a many possiblites,
here are some methods:


Using a Javascript method to embed the Flash is recommended!
With Javascript it is possible to fix some Browser / Flashplayer bugs:





Flash Embedding via Object/Embed Tags (not recommended)

This is the direct / script-free embedding method:
<object width="640" height="480">
<param name="movie" value="krpano.swf">
<embed src="krpano.swf" width="640" height="480">
</embed>
</object>
Note: This is the minimum code you need to embed a Flash movie in a browser. A broken icon will appear on the Web page if the user does not have the Flash plug-in installed. Note: In the code above there is both an <embed> tag and an <object> tag. This is because the <object> tag is recognized by Internet Explorer, and other browsers recognizes the <embed> tag and ignores the <object> tag.

Advantages:
  • no Javascript necessary
  • on some new browsers a automatic Plugin-installer will be started
Disadvantages:
  • Eolas problem on older browsers - see http://en.wikipedia.org/wiki/Eolas
  • no checking for a install Flashplayer
  • no Flashplayer versioncheck
  • no alternative content
  • parameters/arguments must be set twice (once for object tag and once for embed tag)
  • no Javascript access to the flash object
  • no Javascript bugfixes possible (Mousewheel scrolling, Mac bugfixes)

Example - HTML file without Javascript
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
codebase="http://download.macromedia.com/pub/shockwave/ ...linebreak...
          ...continueline... cabs/flash/swflash.cab#version=9,0,28,0" 
        height="100%" width="100%">
  <param name="movie" value="krpano.swf">
  <param name="flashvars" value="pano=krpano.xml">
  <param name="allowFullScreen" value="true">
  <embed src="krpano.swf" 
         pluginspage="http://www.macromedia.com/go/getflashplayer" 
         height="100%" width="100%" allowFullScreen="true"
         flashvars="pano=krpano.xml" />
</object>

click here for a online example - Flash Embedding via Object/Embed Tags





Here a minimal HTML example with SWFObject 1.5:
<html>
<head>
    <title>krpano.com example</title>
</head>
<body>

<div id="krpano">
    <noscript>
        Javascript not activated
    </noscript>
</div>

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

<script  type="text/javascript">

 var so = new SWFObject("krpano.swf","krpanoSWF","100%","100%","9.0.28");
 so.write("krpano");

</script>

</body>
</html>

To use the Flash Player "autoupdate" feature use this code:
...
 var so = new SWFObject("krpano.swf","krpano","100%","100%","9.0.28");
 so.useExpressInstall('expressinstall.swf');
 so.setAttribute('xiRedirectUrl', window.location);
 so.write("krpano");
...



NOTES:
  • It's important to set the correct minimum Flash Player Version 9.0.28
  • When using MPEG4 videos (.mp4) set the minimum Flash Player Version to 9.0.115
  • When using SWFObject 1.5 - the id of the <div> element must be different to the SWF object id (second parameter)


LINKS: (further links about flash to html embedding)

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150
http://kb.adobe.com/selfservice/viewContent.do?externalId=6a253b75 http://www.alistapart.com/articles/flashembedcagematch
http://www.w3schools.com/flash/flash_inhtml.asp
http://www.jeroenwijering.com/?item=Embedding_flash