Take the 2-minute tour ×

This code will open a Flash in a Window after being executed. Is there any way to do: When clicking the Flash (without adding any button), any event will occur?

private void Window_Loaded(object sender, RoutedEventArgs e)
        string filePath = @"C:\Users\IBM\Desktop\snailrunner1.swf";
        SWFFileHeader swfFile = new SWFFileHeader(filePath);
        this.Width = swfFile.FrameSize.WidthInPixels;
        this.Height = swfFile.FrameSize.HeightInPixels;

        WindowsFormsHost host = new WindowsFormsHost();
        FormFlashLibrary.FlashAxControl play = new FormFlashLibrary.FlashAxControl();

        host.Child = play;


        play.Width = (int) this.Width;
        play.Height = (int) this.Height;

share|improve this question
Explain me why do you add a button? –  Likurg Apr 17 '12 at 6:37
l'm not adding any button. My aim is to: Click the flash and occur an event without any button at all. –  hakunabean Apr 17 '12 at 6:42
I can't understand your problem, where you put your flash? –  Likurg Apr 17 '12 at 6:50
@Likurg: There is not a problem at all, all going smooth, jz that this is kind of new research: Clicking a Flash which appear in a Window, and occur an event. Do u have any idea how to do that? Thx. –  hakunabean Apr 17 '12 at 6:57
add comment

1 Answer

up vote 1 down vote accepted

Depends what you want to achieve.

If you just want to handle click event of the WindowsFormHost, which could be considered as a container, there are several events exposed: WindowsFormsHost Class

If you want to respond to a specific flash control inside the flash content it's required that it's exposed by the flash itself. Using the external API with an ActiveX container

share|improve this answer
add comment

Your Answer


