SharePoint Rich-Text filed editor allows us to write the HTML code, but it doesn’t allow us to embed Flash files.

So, I have searched on this issue and come with a solution.  For that, I’m using swfobject.js file and adding some script lines to the page where we want to embed this flash file. Following are the procedures used to embed Flash file in to SharePoint

Step 1: Upload the swfobject.js file to SharePoint library

Step 2: Include the JavaScript file to SharePoint page,

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

Step 3: Add the following javascript lines at the end of the page, before end of the <asp:content>,
<script type="text/javascript">
function EmbedFlash()
{
    //Get the div tag from the file
    var divLayer = document.getElementsByTagName('div');
    //Check the div tag's classname equal to flashcontent
    if (divLayer.length>0)
    {
        var myFlash = new Array()
        for (i=0; i<divLayer.length; i++)
 
        {        
            if (divLayer[i].className == 'flashcontent')
            {
                myFlash.push(divLayer[i].id)
            }
        }
        var so = new Array()
        for (j=0; j<myFlash.length; j++)
 
        {
        //split the div tag based on ::
            tempParam = myFlash[j].split('::')
        //Following method used to display the flash file, swfobject.embedSWF([URL],[div Id],[Height], [Width], [Flash Version], [Background Colour], [Alternative flash or image]);
            swfobject.embedSWF(tempParam[0], tempParam[1], tempParam[2], tempParam[3], tempParam[4], tempParam[5],"expressInstall.swf");
        }
    }
}
EmbedFlash()
</script>

EmbedFlash method gets all the div elements in current page and filters those elements based on classname=’flashcontent’. If div’s calssname is flashcontent, then it split the id of the div tag based on ::  and it call the embedSWF method from swfobject.js to embed the flash file.

Step 4: This is the main step, including the tags to sharepoint Rich-Text Field editor. Add Two div tags in editor as follows,
<div id="video1" />
<div class="flashcontent" id="flash_video.swf::video1::425::355::9::#FFFFFF"></div>

First div tag used to display the image and other div tag used to give the information tojavascript about flashfile.
Div tag is in format as follows,

 id=”[Flash URL]::[div id]::[Height]::[Width]::[FlashVersion]::[Background Colour]

Step 5: After publishing the page, it dispalys the flash conetnt.
 
---
Shantha Kumar .T
tshanthakumar@iotap.com