在WPF中运行Flash
我正在尝试在我的WPF应用程序中运行.swf
文件,我创建了一个html
页面,并且我已经使用object
标签引用了我的.swf
文件,然后在我的Main Window
加载了该html
页面
我的xaml看起来像
<!----> //tried with frame also but no luck
分配来源
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); } }
问题:
当我运行应用程序时,警告会发生ActiveX
内容正在尝试访问等等,当我允许它时,我的主窗口中没有任何内容出现警告多次出现。
如果我直接在浏览器中运行Flash电影,它运行就好了。
问候。
-
我有一个基于闪存的时钟作为我的C:\ Test \ MyClock.swf上的.swf文件
-
我在C:\ Test \ MyHtml.htm有一个htm文件
-
我有网页浏览器控制如下…
-
在运行应用程序时,我看到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."
-
我通过右键单击并左键单击“允许阻止的内容”接受警告。 出现确认弹出窗口,我说
Yes
。 -
我看到了基于Flash的时钟。
WebBrowser控件可以直接支持flash。 如果您不需要在HTML中显示任何内容,则可以直接提供Flash文件的路径。
myWebBrowser.Source = "C:\Test\MyClock.swf"
但是,您仍会收到IE警告消息。