How to embed a flash (.swf) file into asp.net?

后端 未结 5 1496
自闭症患者
自闭症患者 2020-12-14 12:38

How to display a flash (.swf) file into asp.net ?

相关标签:
5条回答
  • 2020-12-14 13:19

    The embed is handled via what you output in HTML -- there's nothing specific about it ASP.NET.

    Put another way, the same way you output any other HTML <B>, <I>, etc., you can output something like:

    <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/IZKl4nA5cmM&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/IZKl4nA5cmM&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
    
    0 讨论(0)
  • 2020-12-14 13:24

    Using HTML5 embed tag alone would do the trick in all modern browsers.

    <embed src="FILE" type="application/x-shockwave-flash" width="X" height="Y" />
    
    0 讨论(0)
  • 2020-12-14 13:25

    got this from YouTube

    <object width="425" height="344">
        <param name="movie" value="http://www.youtube.com/v/Xt5t9BO6xkA&hl=en&fs=1"></param>
        <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
        <embed src="http://www.youtube.com/v/Xt5t9BO6xkA&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
    </object>
    

    You'd only need this:

    <object width="425" height="344">
      <embed src="PATH_TO_YOUR_FILE" type="application/x-shockwave-flash" width="425" height="344"></embed>
    </object>
    
    0 讨论(0)
  • 2020-12-14 13:25

    Use the SWF object javascript helper http://code.google.com/p/swfobject/

    • it is industry standard
    • it hide the differences of flash initializations between browsers
    • it allows you to specify flash variables in browser independed way
    • it allows you to specify required version of the flash player

    See example below

    <script type="text/javascript">
    var flashvars = {
    playlistURL: "playlist.xml",
    skinURL: "skin-transp-grey.swf",
    width: "400", 
    height: "300",
    continuous : "true"
    };
    
    var params = {
    allowscriptaccess: "always",
    allowfullscreen: "true",
    };
    
    var attributes = {
    id: "mediaplayer1",
    name: "mediaplayer1"
    };
    
    swfobject.embedSWF("mediaplayer.swf", "video", "400", "300", "9.0.0", "expressInstall.swf", flashvars, params,attributes);
    </script> 
    
    0 讨论(0)
  • 2020-12-14 13:29

    I would consider using FlashEmbed, a JavaScript tool that you can use to embed Flash objects to you website.

    It is simple to use and has many advantages:

    • it's very simple: just use flashembed("flash10", "/swf/flash10.swf") for example, if you don't need anything special you don't have to study much.
    • there a lots of demos on the site how to configure the tool
    • jQuery support: flashembed is designed for for scripters in mind with polished programming API together with a support for jQuery selectors.
    • JSON configuration: when supplying configuration for Flash objects the values can be complex JavaScript objects with arrays, strings, functions and other objects.
    • Size: the plugin weights around 5 kb when minified.

    If you like you could write an ASP.NET server control, which renders the HTML you'll need on that page:

    1. Includes external script resource link using ScriptManager.RegisterScriptResource(...) (once per page)
    2. Render the flashebmed script using ScriptManager.RegisterClientScript(...) (for ever y flash you want to embed on a page)
    3. Write some useful properties like src, name etc.

    Then, use the control in your pages this way for example:

    <myControls:FlashEmbed runat="server" id="Flash1" Name="Clock" Src="/swf/clock.swf" />
    
    0 讨论(0)
提交回复
热议问题