开发者

How can I play a .swf file on my WPF application?

开发者 https://www.devze.com 2022-12-14 06:01 出处:网络
I want to display a simple .SWF file on my WPF Form. It\'s a simple animation on loop. Is there a control \"box\" type element I can place on my form and just lo开发者_开发问答ad the .swf file to it

I want to display a simple .SWF file on my WPF Form. It's a simple animation on loop.

Is there a control "box" type element I can place on my form and just lo开发者_开发问答ad the .swf file to it so it can play?

Thank you for the help. :D


You basically have to host it inside an html page and then reference the swf through the html page. On the WPF side you'll put a Frame xaml tag in your app that will refer to the html page.

Here's a link about how to do it.


A solution for a similar question can be found here: how to play flash in WPF application

In summary, you can use AXShockwaveFlash. Instructions found: http://www.pooredesign.com/blog/?p=d9165e80-d075-4faf-8a10-bfaf17769198

Also: although the description uses YouTube as an example this should work with local files as well.


You might use a script, as in this page, to load an animation

<html>
<head>
<script type="text/javascript">
window.location.href = 'my_animation.swf';
</script>
</head>
<body>
</body>

you have the choice to create the page dinamically, create the script dynamically or host the page in a control and use its automation.


Well - can you convert this animation into XAML? That would be the best.

WPF and Flash are not really compatible to each other :-)

It could work using the WebBrowser class - there's no elegant way I know, however.

0

精彩评论

暂无评论...
验证码 换一张
取 消