views:

1121

answers:

0

Hi,

I need to play various swf files in a C# application.

They seem to start playing fine but trying to pause it has no effect the 1st time and whites out the panel if I try again.

The code I'm using is below.

Also rewind & forward have no effect.

Any comments or help would be appreciated.

David Knight

namespace MyUI { public partial class ABWithSWF : MyAbstractABFrm { // Keep Track of whats happening enum StateOfPlay {NotSet, Playing, Paused };

    private AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlashCube = new AxShockwaveFlashObjects.AxShockwaveFlash();

    StateOfPlay playState = StateOfPlay.NotSet;

    public ABWithSWF()
    {
        InitializeComponent();
        pnlSwf.Controls.Add(axShockwaveFlashCube);
        axShockwaveFlashCube.Dock = DockStyle.Fill;

    }

// One button that is either play or pause private void btnPlay_Click(object sender, EventArgs e) { // File to play string path = string.Format(@"{0}\graphical summary.swf", Utils.GetSWFPath());

        switch (playState)
        {
            case StateOfPlay.Paused:
                axShockwaveFlashCube.Play();
                btnPlay.ImageIndex = 3;
                playState = StateOfPlay.Playing;
                break;
            case StateOfPlay.Playing:
                axShockwaveFlashCube.StopPlay();
                btnPlay.ImageIndex = 4;
                playState = StateOfPlay.Paused;
                break;
            case StateOfPlay.NotSet:
                axShockwaveFlashCube.LoadMovie(0, path);
                axShockwaveFlashCube.Play();
                btnPlay.ImageIndex = 4;
                playState = StateOfPlay.Playing;
                break;
        }

    }

    private void button2_Click(object sender, EventArgs e)
    {
        axShockwaveFlashCube.Rewind();
    }

    private void button3_Click(object sender, EventArgs e)
    {
        axShockwaveFlashCube.Forward();
    }
}

}