Blog

Share this blog : twitter

Aug 27

Written by: IOTAP ::-- SharePoint Team
Wednesday, August 27, 2008 10:19 AM 

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.

 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

Tags:

1 comment(s) so far...

Re: Add Flash file to SharePoint Rich Text Field Editor

Hi
I have uploaded the swfobject.js file to document library and added the script to the master page template in catalogs.

function embedFlashes() {
var myLayers = document.getElementsByTagName('div');
if (myLayers.length>0) {
var myFlashes = new Array()
for (i=1; i


As a next step I added the
Please view this post on my website to display the video.



tag to the body of the blog post successfully.

But i am not getting videos populated. Any ideas?

where shall i have to upload the .js file and shall i have to update the ’src’ of the below tag.



Thanks
Meera

By Meera on   Friday, October 30, 2009 5:36 PM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 


 
 
 

IOTAP is an IT Consulting and Software Services Company with global delivery centers in Mumbai and Chennai, India. We are a Microsoft Gold Certified Partner and use products and technologies like Dynamics CRM, SharePoint, Silverlight, and the .Net platform to create solutions that help our customers connect, communicate and collaborate effectively