Click here to Skip to main content
15,434,755 members
Articles / Web Development / ASP.NET
Posted 11 Jun 2007


37 bookmarked

SharePoint 2007 Flash Animation Web Part

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
11 Jun 2007Ms-PL
SharePoint 2007 Flash Animation Web Part

Screenshot - flashWebPart.jpg


I've seen that many people are using HTML content web part for displaying Flash animation. I don't recommend this approach for many reasons, one of them being you won't tell your client to edit HTML code for changing Flash properties; so it is better to have a dedicated web part for rendering Flash animation.

Software Requirements

  • Microsoft SharePoint 2007 installed (With Site Collection created on port:80)
  • SharePoint Services 3.0 Extensions for Visual Studio 2005 installed

Using the code

To apply the code, you will need to create a new SharePoint Webpart Project then overrides the web part class file:

using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Utilities;
using System.Web.UI.HtmlControls;
namespace FlashWebPart
    [XmlRoot(Namespace = "FlashWebPart")]
    public class FlashWebPart : Microsoft.SharePoint.WebPartPages.WebPart
        public FlashWebPart()
            this.ExportMode = WebPartExportMode.All;
        protected int flashWidth = 400;
        protected int flashHeight = 300;
        protected string flashUrl = "";
        Category("Flash Info"),
        Description("Width of the web part")]
        public int FlashWidth
                return this.flashWidth;
                this.flashWidth = value;
       Category("Flash Info"),
        Description("Height of the web part")]
        public int FlashHeight
                return this.flashHeight;
                this.flashHeight = value;
        Category("Flash Info"),
        Description("URL of the web part")]
        public string FlashURL
                return this.flashUrl;
                this.flashUrl = value;
        protected override void Render(HtmlTextWriter writer)
            string outHTML = 
            "<OBJECT classid=
            \"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
            flash/,0,0,0\" " +
                        "WIDTH=" + flashWidth + " HEIGHT=" + flashHeight + "> 
            " + "<PARAM NAME=movie VALUE=\"" + flashUrl + "\"> " +
                        "<PARAM NAME=WMODE VALUE=\"Transparent\">" +
                        "<PARAM NAME=quality VALUE=high> " +
                        "<EMBED src=\"" + flashUrl + 
                        "\" quality=high wmode=\"transparent\" WIDTH=\"" + 
            flashWidth + 
                        "\" HEIGHT=\"" + flashHeight + 
                        "\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=
            index.cgi?P1_Prod_Version=ShockwaveFlash\"></EMBED> " 
            + "</OBJECT>";


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Written By
Web Developer
Saudi Arabia Saudi Arabia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Generalhello Pin
clinton13148-Mar-11 16:03
Memberclinton13148-Mar-11 16:03 
Generalwant to display poster image before video play Pin
poonamgharge11-Oct-10 23:06
Memberpoonamgharge11-Oct-10 23:06 
GeneralMy vote of 5 Pin
poonamgharge11-Oct-10 23:02
Memberpoonamgharge11-Oct-10 23:02 
QuestionOne More Thing..... Pin
Christopher Losh20-Apr-09 10:04
MemberChristopher Losh20-Apr-09 10:04 
AnswerRe: One More Thing..... Pin
Mahdi Abdulhamid21-Apr-09 7:31
MemberMahdi Abdulhamid21-Apr-09 7:31 
QuestionRe: One More Thing..... Pin
Christopher Losh21-Apr-09 8:16
MemberChristopher Losh21-Apr-09 8:16 
QuestionRe: One More Thing..... Pin
Christopher Losh23-Apr-09 9:57
MemberChristopher Losh23-Apr-09 9:57 
QuestionIs it supposed to do this? Pin
Christopher Losh20-Apr-09 6:18
MemberChristopher Losh20-Apr-09 6:18 
GeneralWSS 3.0 - Wrong use of the Web Part class Pin
nowisee1-Dec-08 3:17
Membernowisee1-Dec-08 3:17 
GeneralFlash Query Strings Pin
jim iverson20-Nov-08 4:44
Memberjim iverson20-Nov-08 4:44 
Generalextend the webpart Pin
m_Consultant28-Feb-08 2:42
Memberm_Consultant28-Feb-08 2:42 
GeneralIs there a version that might work with WSS v3.0 Pin
Inverted_Diver7-Nov-07 13:22
MemberInverted_Diver7-Nov-07 13:22 
GeneralRe: Is there a version that might work with WSS v3.0 Pin
Mahdi Abdulhamid9-Dec-07 4:37
MemberMahdi Abdulhamid9-Dec-07 4:37 
Questionerror in this.ExportMode Pin
ellenzinha15-Oct-07 1:51
Memberellenzinha15-Oct-07 1:51 
GeneralMore reasons.... Pin
Magnus Salgo21-Aug-07 23:26
MemberMagnus Salgo21-Aug-07 23:26 
GeneralPort 80 Pin
tonyjo22-Jul-07 19:06
Membertonyjo22-Jul-07 19:06 
GeneralRe: Port 80 Pin
Mahdi Abdulhamid22-Jul-07 23:07
MemberMahdi Abdulhamid22-Jul-07 23:07 
Questionmiss the category flashInfo Pin
Gertrud221-Jun-07 22:43
MemberGertrud221-Jun-07 22:43 
AnswerRe: miss the category flashInfo Pin
Mahdi Abdulhamid22-Jun-07 0:38
MemberMahdi Abdulhamid22-Jun-07 0:38 
GeneralRe: miss the category flashInfo Pin
Gertrud226-Jun-07 0:27
MemberGertrud226-Jun-07 0:27 
GeneralRe: miss the category flashInfo Pin
Mahdi Abdulhamid26-Jun-07 1:28
MemberMahdi Abdulhamid26-Jun-07 1:28 
GeneralRe: miss the category flashInfo Pin
jerald jp16-Jul-07 4:41
Memberjerald jp16-Jul-07 4:41 
GeneralRe: miss the category flashInfo Pin
Mahdi Abdulhamid16-Jul-07 5:04
MemberMahdi Abdulhamid16-Jul-07 5:04 
GeneralThanks Pin
merlin98111-Jun-07 9:17
professionalmerlin98111-Jun-07 9:17 
GeneralRe: Thanks Pin
Mahdi Abdulhamid11-Jun-07 10:33
MemberMahdi Abdulhamid11-Jun-07 10:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.