If you are still worried about inserting a Flash Object, please try it!

Source: Internet
Author: User
ArticleDirectory
    • Object and embed labels
    • Use <swfobject>
    • Opensource's swfobject. Net Control
    • Commercial Flash Object Control
    • Aspnetflash webcontrol

Flash objects are often inserted in projects. Generally, a flashobject is stored in HTML.CodeYes:

 
<Object Classid= "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000"
 
Codebase= "Http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8"
 
Width= "320" Height= "220"
ID= "Themediaplayer">
 
<Param Name=Movie Value= "Mediaplayer.swf">
 
<Param Name=Quality Value= "High">
 
<Param Name=Bgcolor Value= "# Ffffff">
<Param Name=Allowfullscreen Value= "False">
 
<Param Name=Swliveconnect Value= "True">
 
<Param Name=AllowScriptAccess Value= "Samedomain">
<Param Name= "Flashvars" Value= "File = mixmediaplaylist. xml & width = 320 & Height = 220 & displaywidth = 320 & displayheight = 200 & autostart = true & backcolor = 0 xffffff">
 
 
 
<Embed Type= "Application/X-Shockwave-flash" 
 
Pluginspage= "Http://www.macromedia.com/go/getflashplayer" 
 
Width= "320" Height= "220" Bgcolor= "# Ffffff" 
Name= "Themediaplayer"
 
SRC= "Mediaplayer.swf"
 
Flashvars= "File = mixmediaplaylist. xml & width = 320 & Height = 220 & displaywidth = 320 & displayheight = 200 & autostart = true & backcolor = 0 xffffff">
 
</Embed>
 
</Object>
 
 
Object and embed labels

It seems complicated. First, it is a <Object> object, followed by a lot of Param, and a new <embed> object comes out, followed by a lot of parameters. This is because of compatibility issues. The object tag is used for IE browsers on Windows, and embed is used for Netscape Navigator browsers on Windows and Macintosh platforms and IE browsers on Macintosh platforms. On Windows, ie uses ActiveX controls to play flash, while other browsers use the Netscape plug-in technology to play flash.

For details, refer to the following documents:
    1. Detailed description of Flash Object and embed labels
    2. Flash Object and embed tag attributes
    3. Adobe official documentation: Macromedia Flash Object and embed tag syntax

 

We can use various methods to output the flashobject code to the client segment in the correct format. However, String concatenation is boring and error-prone, and the code is not readable, is there any better way?

The flashvar parameter of flashobject should be mentioned here. Many applications must use this parameter to input a large number of pair data pairs with complex data formats ), building this parameter is often the most troublesome.

Flashvar: Using flashvars to pass variables to a SwF

Use <swfobject>

Swfobject is an easy-to-use and standard-compliant Method for embedding flash objects in a webpage. You only need to reference a small JS file in the webpage.

Swfobject can be used to avoid browser incompatibility issues caused by the complexity of Flash Object syntax and options.

The general code example using <swfobject> is as follows:

 
<!Doctype Html Public "-// W3C // dtd xhtml 1.0 strict // en" Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<Html Xmlns= "Http://www.w3.org/1999/xhtml" Lang= "En" XML: Lang= "En">
 
<Head>
 
<Title>Swfobject V2.0-Step 3</Title>
 
<Meta HTTP-equiv= "Content-Type" Content= "Text/html; charsets = iso-8859-1" />
<Script Type= "Text/JavaScript" SRC= "Swfobject. js"> </Script>
 
 
 
<SCRIPT type ="Text/JavaScript">
 
Swfobject. registerobject ("Myid","9.0.0","Expressinstall.swf");
 
</Script>
 
 
 
</Head>
<Body>
 
<Div>
 
 
 
<Object ID= "Myid" Classid= "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000" Width= "780" Height= "420">
 
 
<Param Name= "Movie" Value= "Mycontent.swf" />
 
<!--[If!IE]>->
 
<Object Type= "Application/X-Shockwave-flash" Data= "Mycontent.swf" Width= "780" Height= "420">
<!-<![Endif]->
 
<P>Alternative content</P>
 
<!-[If! IE]>->
 
</Object>
 
<!-<![Endif]->
 
</Object>
</Div>
 
</Body>
 
</Html>

Swfobject home: http://code.google.com/p/swfobject/

For the input of the flashvar parameter, swfobject provides a special function, which is very convenient to use and highly readable.

Opensource's swfobject. Net Control

: Http://www.arjones.net/opensource/swfobject.net/

There is also a: http://www.junasoftware.com/servercontrols/swfobject.net.aspx

Commercial Flash Object Control

In fact, for ASP. NET developers, using <swfobject> is still a lot of inconvenient, there is no strong data type, parameter input must be converted into strings, there are some splicing work, the code is still not elegant. Is there a better way?

Aspnetflash webcontrol

Aspnetflash webcontrol allows you to easily insert an Adobe Flash file into your ASP. NET web forms.

 

 

 

Aspnetflash URL: http://www.aspnetflash.com/aspnetflash_Download_Free_Trial.aspx

Download and install:

It's really good. basic attribute settings and support for data binding to flashvar.

 

If you are still worried about inserting a Flash Object, please try it!

Reference:

An article on list apart: http://www.alistapart.com/articles/flashembedcagematch/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.