简体   繁体   中英

Event occurs after clicking a Flash (.swf file type)

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;

        grdMain.Children.Add(host);

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

        play.LoadMovie(filePath);
        play.Play();
    }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM