Most of us now use DW to insert flash directly on webpages, and DW is what we see and what we get. We directly generate 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:
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 = "/support/flash/ts/documents/myFlashMovie.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 ).
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.