How to display a flash (.swf) file into asp.net ?
+2
A:
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>
roman m
2009-03-21 06:21:51
wow, this sure looks ugly in IE8
roman m
2009-03-21 07:42:07
+1
A:
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>
Bill
2009-03-21 06:30:55
+2
A:
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:
- Includes external script resource link using
ScriptManager.RegisterScriptResource(...)
(once per page) - Render the flashebmed script using
ScriptManager.RegisterClientScript(...)
(for ever y flash you want to embed on a page) - 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" />
splattne
2009-03-21 07:15:47
A:
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>
se_pavel
2009-03-24 20:15:50