hello frnd,,
u can see some sample code to play .swf files in .NET.
you follow that way , if u successfully doing it means , u can get the output.
In Visual Studio, File -> New -> Project -> Windows Forms Control
Set Platform target to x86
In Visual Studio, right click on Toolbox window, then "Choose Items"
Navigate to COM components tab and choose Shockwave Flash Object. Press OK.
then next step
Drag "Schockwave Flash Object" from Toolbox to our UserControl and change its name to axShockwaveFlash. Rename our UserControl to FlashAxControl and add following code to it.
/* dnt forget to remove the comments...
public partial class FlashAxControl : UserControl
{
public FlashAxControl()
{
InitializeComponent();
}
public new int Width
{
get { return axShockwaveFlash.Width; }
set { axShockwaveFlash.Width = value; }
}
public new int Height
{
get { return axShockwaveFlash.Height; }
set { axShockwaveFlash.Height = value; }
}
public void LoadMovie(string strPath)
{
axShockwaveFlash.LoadMovie(0, strPath);
}
public void Play()
{
axShockwaveFlash.Play();
}
public void Stop()
{
axShockwaveFlash.Stop();
}
}
*/
then
Build our UserControl. Start new WPF Application and reference to our UserControl, System.Windows.Forms and WindowsFormsIntegration as following
Set Platform Target to x86
Add following code to play SWF in our application
/* remove comments..
string strFilePath = @"e:\temp.swf";
SWFFileHeader swfFile = new SWFFileHeader(strFilePath);
this.Width = swfFile.FrameSize.WidthInPixels;
this.Height = swfFile.FrameSize.HeightInPixels;
WindowsFormsHost host = new WindowsFormsHost();
FormFlashLibrary.FlashAxControl player = new FormFlashLibrary.FlashAxControl();
//the Windows Forms Host hosts the Flash Player
host.Child = player;
//the WPF Grid hosts the Windows Forms Host
grdMain.Children.Add(host);
//set size
player.Width = (int) this.Width;
player.Height = (int) this.Height;
//load & play the movie
player.LoadMovie(strFilePath);
player.Play();
*/
it works well,.,.try it...
Raj.Net, if this helps please login to Mark As Answer. |
Reply | Alert Moderator