Friday, June 06, 2008

How to Embed Flash, Videos in ASP.Net web pages

To embed flash and videos we can use simple HTML embed tag for this purpose.

For example.

<embed src="images/flash02.swf" quality="high" bgcolor="#ffffff" width="775" height="24" name="flash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

enables us to display flash files in Asp.net web pages.

Using JavaScript to display flash in Webpages.


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

Use div tag where you want to display the SWF, use a unique id:


<div id="flashbanner">Your SWF will display here!!.</div>
We can instantiate the FlashSwfObject using below code.

<script type="text/javascript">
var so = new SWFObject('MyMedia.swf','mpl','300','250','7');
so.addParam('allowfullscreen','true');
so.addVariable('file','playlist.xml');
so.addVariable('backcolor','0x000000');
so.addVariable('autostart','true');
so.write('flashbanner');
</script>

No comments: