I am getting an error when trying to embed a flash (.swf) file into my Visual C' form - I have notice this is a fairly common error, though the solutions don't mean much to me.
Here is my code:
public partial class Form6 : Form
private void button1_Click(object sender, EventArgs e)
Form1 frm1 = new Form1();
private void axShockwaveFlash2_Enter(object sender, EventArgs e)
**//this.axShockwaveFlash1.LoadMovie(0, "C:\\Documents and Settings\\Gary\\My Documents\\Flash File\\CalmBay1.swf");**
private void Form6_Load(object sender, EventArgs e)
AxShockwaveFlash axShockwaveFlash = new AxShockwaveFlash();
axShockwaveFlash.Location = new System.Drawing.Point(50, 50);
**axShockwaveFlash.Movie = ("C:\\Documents and Settings\\Gary\\My Documents\\Flash File\\CalmBay1.swf");**
//ShockwaveFlash.Size = new System.Drawing.Size(150, 150);// set size as required
The line with the asterix is where the error is, but as i say, i've no idea on how to resolve it!
Even though it's been months since this question was asked, I just had the same problem. When creating AxShockwaveFlash objects programmatically, you have to initialize:
var flashObj = new AxShockwaveFlash(); ((ISupportInitialize) (flashObj)).BeginInit(); // <-- flashObj.Dock = DockStyle.Fill; flashObj.Enabled = true; ((ISupportInitialize) (flashObj)).EndInit(); // <-- Controls.Add(flashObj); flashObj.AutoSize = true; // All of these properties won't work unless the component has been initialized flashObj.ScaleMode = 1; flashObj.AlignMode = 0; flashObj.LoadMovie(0, @"movie.swf"); flashObj.Stop(); flashObj.Play();
Hopefully this will save future readers some time.
I had the same problem I tried the proposed solutions of calling CreateControl without any success.
It turned out that the interops were generated targeting the .net 2.0 framework and the problem occurred when being called from 4.0 code. The solution was to generate interops using .NET Framework Tools 4.0.