What should I do if the flash size previously provided to customers is not suitable for the website revision? Then I will tell you how to make the flash automatically adjust the height based on the specified width.

Source: Internet
Author: User

After the website is revised, the customer page is narrowed or narrowed, and the flash banner on the customer page is not so obedient at this time, generally, we want to specify a width for the flash to make the flash adaptive height, as shown below:Code

Code

<Embed width = "100%" Height = "100%" src = "/upfiles/uploadpic/companypic/20082xube8s.swf" Quality = "high" pluginspage = "http://www.macromedia.com/go/getflashplayer" type = "application/x -Shockwave-flash "wmode =" Opaque"

 

Or we can specify the flash width as the width of our page width = "770px", but the page display effect is as follows:

What's more black on both sides is the problem that occurs after flash automatically adapts (If your flash width is exactly 770, it won't happen !)

Well, we can specify a width for flash and a height for it, so that it won't be adaptive. But how do you know its height? If you specify one, the above problem will still occur!

(Or if you tell the artist to redo the flash above, you will be scolded by the artist, and the artist will end up exhausted ,~~~~~~ Joke)

Unlike images, flash can be scaled up or down after JS computing!

But we can useProgramTo get it done!

The first is the C # version:

The cool-man on cnblogs has introduced it to us. You can refer to thisArticle

Http://www.cnblogs.com/gmm/archive/2007/07/17/310675.html

Maybe you are using Java for development. For example, I used to use C # And now I am using Java Baidu. I found that there are also some good open-source projects in Java to help solve this problem.

Http://www.jswiff.com/download/index.jsp

Fileinputstream stream =   New Fileinputstream (publishutil. getrootpath () + Flashfile );
Inputbitstream bitstream =   New Inputbitstream (Stream );
Swfheader =   New Swfheader (bitstream );
Rect = Swfheader. getframesize ();
Float Real_width = (Rect. getxmax () - Rect. getxmin ()) / 20l );
Float Real_height = (Rect. getymax () - Rect. getymin ()) / 20l );
If (Real_width > = ( Float ) Width)
{
Float Percent = (( Float ) Width / Real_width );
Height = ( Int ) (Real_height * Percent );
}
Log.info ( " Real width: " + Real_width + " Real height: "   + Height );
String execstring =   " <Object classid = 'clsid: D27CDB6E-AE6D-11cf-96B8-444553540000 'codebase = 'HTTP: // download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=6, 0'width =' "   + Width +   " 'Height =' "   + Height +   " '> <Param name = 'movie' value =' " + Flashfile + " '> <Param name = 'quality' value = 'high'> <Param name = 'wmode' value = 'opaque'> <embed src =' "   + Flashfile +   " 'Quality = 'high' pluginspage = 'HTTP: // www.macromedia.com/go/getflashplayer' type = 'application/X-Shockwave-flash' wmode = 'opaque 'width =' "   + Width +   " 'Height =' "   + Height +   " '> </Embed> </Object> " ;
Log.info ( " SWF code: " + Execstring );
Return Execstring;

If you have any questions, please mail suyuan19@qq.com

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.