How to play swf file in silverlight?

北战南征 提交于 2019-12-01 11:36:31

问题


I am tring to play a .swf in silverlight5 page.I am using the ListBox control or Image Control Or Any Idea To Play swf File in Silvarlight

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

回答1:


You can see in the code below how to use Iframe on Silverlight:

<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);

}



回答2:


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.

Another way is to convert the SWF to XAML using this. But I found quite a lot of swf files that couldn't be converted. Especially if there is a lot of ActionScript or dynamic loading of content involved.




回答3:


I've got the answer for how to play an swf file in Silverlight 5

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



回答4:


This is impossible. Silverlight does not play swf files. If it is just a video file without any interaction, you might be able to convert the video to something that Silverlight can play. Here is some information about the supported formats:
http://msdn.microsoft.com/en-us/library/cc189080%28v=vs.95%29.aspx



来源:https://stackoverflow.com/questions/14392390/how-to-play-swf-file-in-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!