在WPF运行Flash [英] Run Flash in WPF
问题描述
我试图在我的WPF应用程序运行的瑞士法郎
文件,我创建了一个 HTML
页,住在我引用的使用对象
标记,然后装入我的瑞士法郎
文件 HTML
在我的主窗口
我的XAML看起来像
$ b $页b <窗口x:类=sirajflash.MainWindow
的xmlns =http://schemas.microsoft.com/winfx/2006/ XAML /演示
的xmlns:X =http://schemas.microsoft.com/winfx/2006/xaml
标题=主窗口HEIGHT =350WIDTH =525>
<网格和GT;
< web浏览器名称=myBrowser>< / web浏览器>
<! - <框名称=myframe/> - > //试图与框架也,但没有运气
< /网格和GT;
< /窗GT;
指定源
公共部分类主窗口:窗口
{
公共主窗口()
{
的InitializeComponent();
myBrowser.Source =新的URI(CreateAbsolutePathTo(playflash.htm),UriKind.Absolute);
}
私人静态字符串CreateAbsolutePathTo(字符串媒体文件)
{
返回System.IO.Path.Combine(新的FileInfo(Assembly.GetExecutingAssembly()位置).DirectoryName,媒体文件);
}
}
问题:
当我运行应用程序时出现的警告的ActiveX
内容试图访问等等等等,当我允许它什么出现在警告保持上发生的多次我的主窗口。
如果我在浏览器中运行的Flash影片直接运行就好了。
问候。
-
我有一个基于Flash时钟作为我的C .swf文件:\Test \MyClock.swf
-
我有℃的htm文件:\Test\MyHtml.htm
<嵌入SRC = C:\Test\MyClock.swf
宽度= 200 HEIGHT = 200
的wmode =透明类型=应用程序/ x -shockwave闪光>
< /嵌入>
-
我有如下Web浏览器控件...
<窗口x:类=MyFlashApp.MainWindow
的xmlns =http://schemas.microsoft.com/winfx/2006/xaml /演示
的xmlns:X =http://schemas.microsoft.com/winfx/2006/xaml
标题=主窗口HEIGHT =350WIDTH =525>
<网格和GT;
< web浏览器源=C:\Test\MyHtml.htm>< / web浏览器>
< /网格和GT;
< /窗GT;
-
在运行的应用程序,我看到了WebBrowser控件给予警告为
为帮助保护您的安全,Internet Explorer已经限制显示可能访问您的计算机的活动内容文件。单击此处查看选项。
-
我接受右键和左键单击警告允许阻止的内容。确认弹出窗口,而我说的
是
。 -
我看到了基于Flash的时钟。
i am trying to run a .swf
file in my WPF application, i have created a html
page and in that i have referenced my .swf
file using object
tag and then loading that html
page in my Main Window
my xaml looks like
<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>
assigning the source
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);
}
}
The Problem:
when i run the application the warning occurs that ActiveX
content is trying to access etc etc and when i allow it nothing appears in my main window the warning keeps on occuring multiple times.
if i run the flash movie in the browser directly it runs just fine.
Regards.
I have a flash based clock as a .swf file on my C:\Test\MyClock.swf
I have a htm file at C:\Test\MyHtml.htm
<embed src=C:\Test\MyClock.swf width=200 height=200 wmode=transparent type=application/x-shockwave-flash> </embed>
I have web browser control as below...
<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>
On running the app, I see the webbrowser control giving warning as
"To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options."
I accept the warning by right click and the left click "Allow Blocked Content". A confirmation popup appears to which I say
Yes
.I see the Flash based clock.
这篇关于在WPF运行Flash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!