在WPF中运行Flash

Joh*_*n x 6 c# flash wpf xaml

我正在尝试.swf在我的WPF应用程序中运行一个文件,我创建了一个html页面,并且我已经.swf使用object标记引用了我的文件,然后html在我的文件中加载了该页面Main Window

我的xaml看起来像

<Window x:Class="sirajflash.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WebBrowser Name="myBrowser"></WebBrowser>
        <!--<Frame Name="myframe"/>--> //tried with frame also but no luck
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

分配来源

   public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            myBrowser.Source = new Uri(CreateAbsolutePathTo("playflash.htm"), UriKind.Absolute);
        }
        private static string CreateAbsolutePathTo(string mediaFile)
        {
            return System.IO.Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName, mediaFile);
        }
    }
Run Code Online (Sandbox Code Playgroud)

问题:

当我运行应用程序时,警告会发生ActiveX内容正在尝试访问等等,当我允许它时,我的主窗口中没有任何内容出现警告多次出现.

如果我直接在浏览器中运行flash影片它运行正常.

问候.

WPF*_*-it 5

  1. 我的 C:\Test\MyClock.swf 上有一个基于闪存的时钟作为 .swf 文件

  2. 我在 C:\Test\MyHtml.htm 有一个 htm 文件

      <embed src=C:\Test\MyClock.swf
             width=200 height=200
             wmode=transparent type=application/x-shockwave-flash>
      </embed>
    
    Run Code Online (Sandbox Code Playgroud)
  3. 我有如下的网络浏览器控件...

    <Window x:Class="MyFlashApp.MainWindow"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       Title="MainWindow" Height="350" Width="525">
      <Grid>
        <WebBrowser Source="C:\Test\MyHtml.htm"></WebBrowser>
      </Grid>
    </Window>           
    
    Run Code Online (Sandbox Code Playgroud)
  4. 在运行应用程序时,我看到 webbrowser 控件发出警告 "To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options."

  5. 我通过右键单击并左键单击“允许阻止的内容”来接受警告。出现一个确认弹出窗口,我说Yes

  6. 我看到了基于 Flash 的时钟。