C # Play flash. Call Microsoft ActiveX

Source: Internet
Author: User
Tags rewind

Flash playback
First, make sure that there is a flash plug-in the computer, that is, the flash can be played when the IE browser browses the web page. In fact, an ActiveX component provided by Macromedia is used for flash playback. The actviex component is swflash. ocx, which can be found in the system directory. To reference a project, follow these steps:
1. Select "toolbox", right-click, and select "select item" from the shortcut menu ".
2. In the displayed "select toolbox items" dialog box, select the "COM components" tab.
3. In the COM component list, click the [browse] button and select \ system32 \ macromed \ Flash \ swflash. ocx in the dialog box ".
Common Methods for axshockwaveflash include.
Play () method, used to play an animation.
Stop () method, used to stop playing an animation.
Rewind () method, used for the first animation after playback.
Back (), used to play the previous animation.
The forward () method, used to play the last frame of the animation.

Now, create a new one in your new form.
Axshockwaveflash1, button1, button2, button3, button4, buttn5, buttn6, buttn7, openfiledialog1.
Then write the following code into each button.

Private void button#click (Object sender, eventargs e) // open the Flash file
{
Openfiledialog1.file = "Flash file (*. SWF) | *. SWF | all files (*. *) | *.*";
If (openfiledialog1.showdialog () = dialogresult. OK)
{
String myfilename = openfiledialog1.filename;
This. axshockwaveflash1.move = myfilename;
}
}
Private void button2_click (Object sender, eventargs E)
{// Pause playback
This. axshockwaveflash1.stop ();
}
Private void button3_click (Object sender, eventargs E)
{// Play the first frame
This. axshockwaveflash. Rewind ();
}
Private void button4_click (Object sender, eventargs E)
{// Play the last frame
This. axshockwaveflash1.back ();
}
Private void button5_click (Object sender, eventargs E)
{// Play the next frame
This. axshockwaveflash1.forward ();
}
Private void button6_click (Object sender, eventargs E)
{// Start playing
Thyis. axshockwaveflash1.rewind ();
This. asshockwaveflash1.play ();
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.