Example of playing Flash in HTML

Source: Internet
Author: User

First, create an independent Javascript file (such as flash. JS) to add a Flash Player.CodeAs follows:

Function Createflash (idad, swfurl, Wad, had, ){
VaR Str = " <Object classid = \ "CLSID: d27cdb6e-ae6d-11cf-96b8-444553540000 \" codebase = \ "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=7,0, 0 \" width = \" " + Wad + " \ "Height = \" " + Had + " \ "Id = \" " + Idad + " \ "Align = \" Middle \ "> " ; Str + = " <Param name = \ "allowScriptAccess \" value = \ "always \"> " ; Str + = " <Param name = \ "Quality \" value = \ "High \"> " ; Str + = " <Param name = \ "wmode \" value = \ "Opaque \"> " ; Str + = " <Param name = \ "movie \" value = \" " + Swfurl + " \ "> " ; Str + = " <Param name = \ "flashvars \" value = \" " + VS + " \ "> " ; Str + = " <Embed src = \" " + Swfurl + " \ "Flashvars = \" " + VS + " \ "Quality = \" High \ "wmode = \" Opaque \ "width = \" " + Wad + " \ "Height = \" " + Had + " \ "Name = \" " + Idad + " \ "Align = \" Middle \ "allowScriptAccess = \" always \ "type = \" application/X-Shockwave-Flash \ "pluginspage = \" http://www.macromedia.com/go/getflashplayer\ "> " ; Str + = " </Object> " ; Document. Write (STR );}

 

Then, create an XML file (such as inddata. XML) to save the path address of the image. The Code is as follows:

< Data >
< L Big = "Big_img/big_img1.jpg" Small = "Small_img/small_img1.jpg" URL = "Http://xugang.cnblogs.com" />
< L Big = "Big_img/big_img2.jpg" Small = "Small_img/small_img2.jpg" URL = "Http://xugang.cnblogs.com" />
< L Big = "Big_img/big_img3.jpg" Small = "Small_img/small_img3.jpg" URL = "Http://xugang.cnblogs.com" />
</ Data >

Note: Specify the address path of the large image and small icon in the XML file.

 

Finally, write the following code in the HTML file of the webpage:

<! -- Add JS references to the head label. -->
< Script SRC = "../JS/flash. js" Language = "JavaScript" > </ Script >
......
<! -- Add the flash code to the body tag. -->
< Div Class = "Bnrind" >
< Script Language = "JavaScript" >
// When initializing flash, it contains the XML Path
Createflash ( " Banner " , " ../Aboutus/banner.swf " , 1002 , 280 , " Data = inddata. xml " );
</ Script >
</ Div >

 

The effect is as follows:

<Div class = "bnrind"> <br/> </div> <br/>
[Ctrl + A select all tips: you can modify some code and then press run]

 

Sample download

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.