Most of us now use DW to insert Flash directly, and DW is what we see and what we get, directly generating the corresponding flash display.Code. But how many of us know the code directly generated by DW? In fact, when I first learned HTML, at that time, there was only one simple <embed src = "" width = "" Height = "> </embed> sentence to insert Flash into the book, and for a long time, as long as I insert Flash into the webpage, I also wrote this. At that time, I thought that writing this was simple and easy to remember, saving code, but I had doubts about DW. Why is this simple code, it is so complicated. But if you think about it, the code generated by DW will have its own truth. In later applications, I should also prove my judgment (haha, maybe the idea was originally a dish ).
Over the past few weeks, I have been working on flash applications related to JS and. Net interactions, so I have a better understanding of object and embed labels. In the past two days, we have implemented the webpage drag Block Layout function in Flash (similar to the JS layout of QQ space). Because different users need to load and output different user configuration files, so I thought. <Param name = "flashvars" value = "import=userimport1.txt&output=useroutput1.txt"> is used to pass the relevant file variables to flash. However, in practical applications, it is found that Firefox, opera, and other browsers do not support variable transfer. More specifically, they do not support <param> labels. So today I took the time to collect and integrate the relevant content on the MM network.
I. Introduction:
If we want to display the Flash content normally on the webpage, the webpage must have a tag with the specified flash path. That is, the object and embed labels. 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.
The following is a simple example of code for inserting flash into a webpage: replace 1.swf with your own Flash animation to display it.
Complete code:
<Object classid = "CLSID: d27CDB6E-AE6D-11cf-96B8-444553540000 "codebase =" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0 "width =" 550 "Height =" 400 "id =" mymoviename "> <Param name = movie value =" myflashmovie.swf "> <Param name = Quality Value = high> <Param name = bgcolor value = # ffffff> <embed src = "1.swf" Quality = high bgcolor = # ffffff width =" 550 "Height =" 400 "name =" mymoviename "align =" "type =" application/X-Shockwave-flash "pluginspage =" http://www.macromedia.com/go/getflashplayer "> </embed> </Object>
2. Why should all the above labels be used? Can some labels be omitted?
The object tag is used in Windows ie3.0 and later browsers or other browsers that support ActiveX controls. The "classid" and "codebase" attributes must be exactly written as shown in the preceding example. They tell the browser to automatically download the Flash Player address. If you have not installed Flash Player, then ie3.0 and later browsers will jump out of a prompt box to see if you want to automatically install Flash Player. Of course, if you do not want users who do not have Flash Player installed to automatically download the player, you may omit the code.
Embed labels are used in Netscape navigator2.0 and later browsers or other browsers that support the Netscape plug-in. The pluginspage attribute tells the browser the address for downloading the Flash Player. If Flash Player is not installed, restart the browser after installation.
To ensure that most browsers can normally display flash, you need to nest the embed tag in the object tag, just like the code example above. Browsers that support ActiveX controls will ignore the embed tag in the object tag. Netscape and IE browser using plug-ins will only read the embed tag, but will not recognize the object tag. That is to say, if you omit the embed tag, Firefox will not be able to identify your flash (but it is puzzled that, If you omit the object, only embed will be written, and IE will be able to display the flash normally, take a closer look ).
Therefore, the web page code that shows flash is as follows:
<Embed src = "1.swf" width =" 500 "Height =" 400 "> </embed>
This article lists the necessary and optional attributes of the object and embed labels used to publish a video.
1. required attributes:
· Classid-sets the ActiveX control of the browser, which is only used for object labels.
· Codebase-set the position of the Flash ActiveX control. If the browser is not installed, it can be automatically downloaded and installed. Only used for object tags.
· Width-specify the width of the Flash video in percentages or pixels.
· Height-specify the height of the Flash video in percentages or pixels.
· Src-specifies the video. Only for embed labels.
· Pluginspage-set the flash plug-in location. If the browser is not installed, it can be automatically downloaded and installed. Only for embed labels.
· Movie-specifies the video. Only used for object tags.
2. Optional attributes and available values:
· ID-set the variable name for reference of script code. Only for objects.
· Name-set the variable name for reference of script code (such as JavaScript. Embed only.
· Swliveconnect-(true or false) Specifies whether to enable Java when Flash Player is downloaded for the first time. If some attributes are omitted, the default value is false. If you use JavaScript and flash on the same page, Java must use fscommand to work.
· Play-(true or false) specifies whether the Flash video is automatically played after the download is complete. If this attribute is omitted, the default value is true.
· Loop-(true or false) Specifies whether to stop or continue loop playback after the last frame of the video is played. If this attribute is omitted, the default value is true.
· Menu-(true or false)
· True: displays all menus, allowing you to zoom in or zoom out to control video playback and other operations.
· False: only the set options and flash menus are displayed.
· Quality-(low, high, autolow, autohigh, best)
· Low is faster than beautiful and does not apply anti-sawtooth.
· Autolow focuses on speed at the beginning, but it can be improved at any time when needed.
· Autohigh focuses on both playback speed and aesthetic, but sacrifices the aesthetic to ensure playback speed when needed.
· Medium applies some anti-sawtooth bitmap without smoothing the bitmap. Its quality is higher than the low setting but lower than the high setting.
· High aesthetics is superior to playback speed, and anti-aliasing is always applied. If the video does not contain an animation, the bitmap will be smoothed; if the video contains an animation, the bitmap will not change.
· Best provides the best display quality without considering the playback speed. All outputs apply anti-sawtooth and all bitmaps are smoothed.
· Scale-(showall, noborder, exactfit)
· The default (show all) video is displayed in the specified area, but the original proportion is maintained. A border will appear on both sides of the video.
· No boder compresses the film to fit the specified area and keeps the film undistorted. However, some films may be cropped. However, keep the original proportion of the video.
· Exact fit enables the entire video to be displayed in the specified area. The film may be distorted without retaining the original proportion.
· Align-(L, t, R, B)
· The default value is center. When the browser window is smaller than the video, the edge is cropped.
· Left, right, top, and bottom are aligned along the edge of the browser according to the corresponding settings. If necessary, the other three sides will be cropped.
· Salign-(L, t, R, B, Tl, TR, BL, Br)
· L, R, T, B
· TL, tr
· BL, BR
· Wmode-(window, opaque, transparent) sets the window mode attribute of the Flash video, specifying the transparency, stack, and position of the flash in the browser.
· Window Film is played in the browser's rectangular window.
· The opaque film hides all content behind it.
· Transparent makes the Flash video transparent and displays the webpage content behind the transparent video. This will reduce the animation performance. This attribute is not available in all browsers.
· Bgcolor-(# rrggbb, hexadecimal RGB value .) Specifies the background color of the video. Use this property to overwrite the background color set in flash.
· Base-sets the reference directory or URL to solve the relative path in flash. Similar to the <base> label on a webpage.
· Flashvars transmits variables to Flash Player. Flash player6 and later versions are required.
· Pass the root variable to the video. The string format is the name = value set separated.
· The browser supports 64 kB String Length.
· For more information about flashvars, see related documents.