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