我正在尝试在我的 WPF 应用程序中运行 SWF 游戏。这个游戏接受一些应该不断更新的变量(大约每秒 100 次)。我做了一些研究,我知道在 WPF 中运行 SWF 基本上有两种可能性:
- 嵌入 WebBrowser 并将路径传递给 SWF 文件。
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// fixes warning about ActiveX security
string C_Drive_local = "file://127.0.0.1/c$/";
// path of the flash file, here its in C:\DemoContent\bounce.swf
Uri swfPath = new Uri( C_Drive_local + "DemoContent/bounce.swf");
// load it in the browser
MySWFBrowser.Source = swfPath;
}
- 使用 WindowsFormsHost 托管 AxShockwaveFlash 控件
private void FlashLoaded(object sender, RoutedEventArgs e)
{
WindowsFormsHost formHost = new WindowsFormsHost();
AxShockwaveFlash axShockwaveFlash = new AxShockwaveFlash();
formHost.Child = axShockwaveFlash;
mainGrid.Children.Add(formHost);
string flashPath = Environment.CurrentDirectory;
flashPath += @"\game.swf";
axShockwaveFlash.Movie = flashPath;
}
我想尝试使用 AxShockwaveFlash,因为它提供了设置变量的方法,但在我的 COM 对象中我看不到 AxInterop.ShockwaveFlashObjects.dll 我尝试安装几个不同版本的 Flash Player,但没有成功。我找不到任何关于它的信息。如何获得 AxInterop.ShockwaveFlashObjects.dll ?我应该安装什么才能拥有它?