简体   繁体   English

如何在silverlight中播放swf文件?

[英]How to play swf file in silverlight?

我想在silverlight5页面播放.swf。我正在使用ListBox控件或图像控件或任何想法在Silvarlight中播放swf文件

<Image Grid.Row="0" Name="bottom_video" Height="80" Source="{Binding VodeoUrl,Mode=OneWay}" Margin="0,20,0,0" /> 

You might be able use the the Flash ActiveX control that is automatically installed with the flash player itself on every windows machine but if it works it'd still comes with a lot of limitations as stated here another problem will be the "Airspace" problem . 您可以在每台Windows机器上使用随Flash播放器本身自动安装的Flash ActiveX控件,但如果它有效,它仍然会带来很多限制,如此处所述另一个问题是“空域”问题

Another way is to convert the SWF to XAML using this . 另一种方法是使用的SWF转换为XAML But I found quite a lot of swf files that couldn't be converted. 但是我发现了很多无法转换的swf文件。 Especially if there is a lot of ActionScript or dynamic loading of content involved. 特别是如果涉及很多ActionScript或动态加载内容。

You can see in the code below how to use Iframe on Silverlight: 您可以在下面的代码中看到如何在Silverlight上使用Iframe:

<Grid x:Name="LayoutRoot">

        <HyperlinkButton Content="HyperlinkButton" Height="23" HorizontalAlignment="Left" Margin="44,20,0,0" Name="hyperlinkButton1" VerticalAlignment="Top" Width="100" TargetName="" Click="hyperlinkButton1_Click"  />

    </Grid>



code behind:



private void hyperlinkButton1_Click(object sender, RoutedEventArgs e)        { 



HtmlDocument _document = HtmlPage.Document;


            HtmlElement iframe = _document.CreateElement("IFRAME");
            iframe.SetAttribute("src", "http://localhost:52878/TestForm.aspx");


            iframe.SetStyleAttribute("position", "absolute");
            iframe.SetStyleAttribute("top", "100px");
            iframe.SetStyleAttribute("left", "200px");
            HtmlElement body = (HtmlElement)_document.GetElementsByTagName("BODY")[0];
            body.AppendChild(iframe);

HtmlDocument _document = HtmlPage.Document;

            HtmlElement iframe = _document.CreateElement("IFRAME");

            iframe.SetAttribute("src", "http://localhost:52878/TestForm.aspx");

            iframe.SetStyleAttribute("position", "absolute");

            iframe.SetStyleAttribute("top", "100px");

            iframe.SetStyleAttribute("left", "200px");

            HtmlElement body = (HtmlElement)_document.GetElementsByTagName("BODY")[0];

            body.AppendChild(iframe);

}

我已经得到了如何在Silverlight 5中播放swf文件的答案

 <WebBrowser Grid.Row="1" VerticalAlignment="Top" Source="{Binding VodeoUrl,Mode=OneWay}" Height="280" Width="280"/>

This is impossible. 这是不可能的。 Silverlight does not play swf files. Silverlight不播放swf文件。 If it is just a video file without any interaction, you might be able to convert the video to something that Silverlight can play. 如果它只是一个没有任何交互的视频文件,您可以将视频转换为Silverlight可以播放的内容。 Here is some information about the supported formats: 以下是有关支持格式的一些信息:
http://msdn.microsoft.com/en-us/library/cc189080%28v=vs.95%29.aspx http://msdn.microsoft.com/en-us/library/cc189080%28v=vs.95%29.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM