[AS3]as3自适应屏幕宽高的源代码实例(2)
第二步:改变swf文件的html页面 html xmlns = http://www.w3.org/1999/xhtml head meta http-equiv = Content-Type content = text/html;charset=UTF-8 title 酷播技术 / title script src = AC_OETags.js language
第二步:改变swf文件的html页面
- <html xmlns="http://www.w3.org/1999/xhtml"><head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>酷播技术</title>
- <script src="AC_OETags.js" language="javascript"></script>
- <script language="javascript">
- setTimeout("exchangePage();", 1000*4);
- function exchangePage()
- {
- var t1_obj = document.getElementById('t1');
- t1_obj.style.width = '100%';
- t1_obj.style.height = '100%';
- }
- </script>
- <style>
- *{margin:0px; padding:0px;}
- body{
- margin:0px auto;
- overflow:auto;
- background:#000000;
- height:100%;
- text-align: center;
- }
- #content{margin:0px auto; width:100%; height:100%; text-align:center;}
- #t1{width:1px; height:1px;}
- .temp{color:#FFF; font-size:14px; text-align:left; width:250px; margin:0px auto;}
- </style>
- </head>
- <body>
- <div style="width: 1250px; height: 650px; overflow:hidden; " id="content" align="center">
- <div style="width: 1250px; height: 650px; overflow:hidden; " id="t1">
- <script language="JavaScript" type="text/javascript">
- var requiredMajorVersion = 10;
- var requiredMinorVersion = 0;
- var requiredRevision = 0;
- var Config = {
- 'service_url': 'http://www.cuplayer.com/service/service',
- 'bbs_url': 'http://bbs.cuplayer.com/forum-112-1.html',
- 'event_url': 'http://tt.cuplayer.com/index/event',
- 'home_url': 'http://tt.cuplayer.com/',
- 'save_url': 'http://tt.cuplayer.com/',
- 'vip_url': 'http://tt.cuplayer.com/index/content/cid/115/id/724',
- 'payment_url': 'http://www.cuplayer.com/payment/payment/payment',
- 'adult_check_url': 'http://www.cuplayer.com/member/member/idcard'
- };
- function writeFlashObject(swf_src, param_str)
- {
- document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"100%\" height=\"100%\" id=\"wGame\" align=\"middle\"\>\n");
- document.write("<param name=\"allowScriptAccess\" value=\"always\" /\>\n");
- document.write("<param name=\"movie\" value=\""+ swf_src +"\" /\>\n");
- document.write("<param name=\"allowFullScreen\" value=\"true\" />");
- document.write("<param name=\"WMode\" value=\"Transparent\">");
- document.write("<param name=\"FlashVars\" value=\""+ param_str +"\" /\>\n");
- document.write("<param name=\"quality\" value=\"high\" /\>\n");
- document.write("<param name=\"bgcolor\" value=\"#000000\" /\>\n");
- document.write("<embed src=\""+ swf_src +"\" quality=\"high\" bgcolor=\"#000000\" width=\"100%\" height=\"100%\" name=\"wGame\" align=\"middle\" allowScriptAccess=\"always\" FlashVars=\""+ param_str +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /\>");
- document.write("</object\>");
- }
- //<!--
- // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
- var hasProductInstall = DetectFlashVer(6, 0, 65);
- // Version check based upon the values defined in globals
- var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
- // document.write("如果显示了这段文字,那么您的浏览器支持 JavaScript")
- if ( hasProductInstall && !hasRequestedVersion ) {
- // DO NOT MODIFY THE FOLLOWING FOUR LINES
- // Location visited after installation is complete if installation is required
- var alternateContent = '<div class="temp"><p>您的flash版本过低,需要升级才能获得更好的游戏体验。</p>'
- +'<p><b>#下载链接:</b></p>'
- +'<p><a href="http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe">最新版</a></p>'
- +'<p><a href="http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_ax_debug.exe">最新版 (IE)</a></p>'
- +'<p><a href="http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_plugin_debug.exe">最新版 (非IE)</a></p>'
- +'<p>最新版Flash Player在线安装:<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">IE</a>、<a href="http://www.adobe.com/shockwave/download/alternates/" target="_blank">非IE</a></p></div>';
- document.write(alternateContent); // insert non-flash content
- } else if (hasRequestedVersion) {
- writeFlashObject("Main.swf?version=TianTu-1.6.0-r10859-release", "serid=9&res=http://ttcdn.92haowan.com/TianTu_release_r10885〈=zh_CN&web=http://tt4.92haowan.com&gatewaygateway=gateway.php&svrip=tt4.92haowan.com&svrport=39000&version=TianTu-1.6.0-r10859-release&auth_key=8b8a851cbec1351afa1a2ec48c40472f&service_url=http%3A%2F%2Fwww.92haowan.com%2Fservice%2Fservice&bbs_url=http%3A%2F%2Fbbs.92haowan.com%2Fforum-112-1.html&event_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fevent&home_url=http%3A%2F%2Ftt.92haowan.com%2F&save_url=http%3A%2F%2Ftt.92haowan.com%2F&vip_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fcontent%2Fcid%2F115%2Fid%2F724&payment_url=http%3A%2F%2Fwww.92haowan.com%2Fpayment%2Fpayment%2Fpayment&adult_check_url=http%3A%2F%2Fwww.92haowan.com%2Fmember%2Fmember%2Fidcard&guide_map_id=48&adult_mark=0")} else { // flash is too old or we can't detect the plugin
- var alternateContent = '<div class="temp"><p>您还未安装flash,请下载安装后进行游戏。</p>'
- +'<p><b>#下载链接:</b></p>'
- +'<p><a href="http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe">最新版</a></p>'
- +'<p><a href="http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_ax_debug.exe">最新版 (IE)</a></p>'
- +'<p><a href="http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_plugin_debug.exe">最新版 (非IE)</a></p>'
- +'<p>最新版Flash Player在线安装:<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">IE</a>、<a href="http://www.adobe.com/shockwave/download/alternates/" target="_blank">非IE</a></p></div>';
- document.write(alternateContent); // insert non-flash content
- }
- // -->
- </script><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" name="wGame" width="100%" height="100%" align="middle" id="wGame">
- <param name="allowScriptAccess" value="always">
- <param name="movie" value="Main.swf?version=TianTu-1.6.0-r10859-release">
- <param name="FlashVars" value="serid=9&res=http://ttcdn.92haowan.com/TianTu_release_r10885&lang=zh_CN&web=http://tt4.92haowan.com&gateway=gateway.php&svrip=tt4.92haowan.com&svrport=39000&version=TianTu-1.6.0-r10859-release&auth_key=8b8a851cbec1351afa1a2ec48c40472f&service_url=http%3A%2F%2Fwww.92haowan.com%2Fservice%2Fservice&bbs_url=http%3A%2F%2Fbbs.92haowan.com%2Fforum-112-1.html&event_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fevent&home_url=http%3A%2F%2Ftt.92haowan.com%2F&save_url=http%3A%2F%2Ftt.92haowan.com%2F&vip_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fcontent%2Fcid%2F115%2Fid%2F724&payment_url=http%3A%2F%2Fwww.92haowan.com%2Fpayment%2Fpayment%2Fpayment&adult_check_url=http%3A%2F%2Fwww.92haowan.com%2Fmember%2Fmember%2Fidcard&guide_map_id=48&adult_mark=0">
- <param name="quality" value="high">
- <param name="bgcolor" value="#000000">
- <param name="allowFullScreen" value="true" />
- <param name="WMode" value="Transparent">
- <embed src="Main.swf" quality="high" bgcolor="#000000" name="wGame" allowscriptaccess="always" flashvars="serid=9&res=http://ttcdn.92haowan.com/TianTu_release_r10885&lang=zh_CN&web=http://tt4.92haowan.com&gateway=gateway.php&svrip=tt4.92haowan.com&svrport=39000&version=TianTu-1.6.0-r10859-release&auth_key=8b8a851cbec1351afa1a2ec48c40472f&service_url=http%3A%2F%2Fwww.92haowan.com%2Fservice%2Fservice&bbs_url=http%3A%2F%2Fbbs.92haowan.com%2Fforum-112-1.html&event_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fevent&home_url=http%3A%2F%2Ftt.92haowan.com%2F&save_url=http%3A%2F%2Ftt.92haowan.com%2F&vip_url=http%3A%2F%2Ftt.92haowan.com%2Findex%2Fcontent%2Fcid%2F115%2Fid%2F724&payment_url=http%3A%2F%2Fwww.92haowan.com%2Fpayment%2Fpayment%2Fpayment&adult_check_url=http%3A%2F%2Fwww.92haowan.com%2Fmember%2Fmember%2Fidcard&guide_map_id=48&adult_mark=0" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="100%" align="middle" height="100%"></object>
- </div>
- <script language="javascript" type="text/javascript">
- //flash窗口大小设置
- function resizeBrowser()
- {
- var max_width = 1250;
- var max_height= 650;
- contentObj = document.getElementById('content');
- var bodyWidth = (window.innerWidth) ? window.innerWidth : (document.body && document.body.clientWidth) ? document.body.clientWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
- var bodyHeight = (window.innerHeight) ? window.innerHeight : (document.body && document.body.clientHeight) ? document.body.clientHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
- if (bodyWidth > max_width)
- {
- contentObj.style.width = max_width + 'px';
- }
- else
- {
- contentObj.style.width = '100%';
- }
- if (bodyHeight > max_height)
- {
- contentObj.style.height = max_height + 'px';
- }
- else
- {
- contentObj.style.height = '100%';
- }
- if (document.getElementById('wGame'))
- {
- document.getElementById('wGame').focus();
- }
- }
- resizeBrowser();
- window.onresize=resizeBrowser;
- </script>
- <noscript>
- 您的的浏览器不支持JavaScript,请从打开相关设置。
- </noscript>
- </div></body></html>
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- [AS3]as3.0的sound类常用技巧整理
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...