FCI-Helwan blog

Just another FCI-H weblog

How to Play Flash (SWF) inside C#

Playing Flash (*.SWF) inside C# program with the ability to play ,pause and forward the movie :

All what you should to do in the first is to import the this two reference in the project as in this figure .

In the InitializeComponent function from Form.Designer.cs define your flash object as this :

this.AxShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash();

then
//
// AxShockwaveFlash1
//
this.AxShockwaveFlash1.Enabled = true;
this.AxShockwaveFlash1.Location = new System.Drawing.Point(12, 12);
this.AxShockwaveFlash1.Name = “AxShockwaveFlash1”;
this.AxShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject(“AxShockwaveFlash1.OcxState”)));
this.AxShockwaveFlash1.Size = new System.Drawing.Size(525, 266);

To fill your Flash Object by SWF file:

AxShockwaveFlash1.Movie = “c:\ahmed.swf”;
To forward or pause the flash object :
AxShockwaveFlash1.Forward();

To Play the flash object :
AxShockwaveFlash1.Play();

To download the complete demo :
http://www.4shared.com/file/18894952/5c361521/openflash.html

Advertisements

June 30, 2007 - Posted by | C#

5 Comments »

  1. Nice post, Essawy
    You may got this error
    Cannot initilize the component…

    So Start->Run->

    regsvr32 C:\Windows\system32\Macromed\Flash\flash7.ocx
    OR
    regsvr32 C:\Windows\system32\Macromed\Flash\flash8.ocx
    OR
    regsvr32 C:\Windows\system32\Macromed\Flash\flash9c.ocx

    Just see your OCX version.

    Comment by Ramy Mahrous | July 1, 2007 | Reply

  2. The download link is broken.
    I also found this link useful http://blogs.vbcity.com/drydo/archive/2005/12/07/5731.aspx

    Comment by Anonymous | October 3, 2007 | Reply

  3. Hello, where do you get those two dlls from. Thank You.

    Comment by Ahmed | February 25, 2008 | Reply

  4. here are the links to the DLLs :

    Interop.ShockwaveFlashObjects.dll :

    http://ahmedessawy.googlepages.com/Interop.ShockwaveFlashObjects.dll

    AxInterop.ShockwaveFlashObjects.dll :

    http://ahmedessawy.googlepages.com/AxInterop.ShockwaveFlashObjects.dll

    Comment by Ahmed Essawy | March 14, 2008 | Reply

  5. what is this resource??
    resources.GetObject….
    it gives me error

    Comment by Hossam | July 9, 2008 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: