Я использую этот JavaScript для встраивания моего flash-файла в веб-страницу:
<script type="text/javascript" src="files/swfobject.js">//</script>
<script type="text/javascript" src="files/swfaddress.js">//</script>
<script type="text/javascript" src="files/facebook.js">//</script>
<script type="text/javascript">
var assetsFolder = 'assets';
var mobileFolder = 'mobile';
var changeURL = function(){
if(document.getElementById('hrefMobile'))document.getElementById('hrefMobile').href = dir+mobileFolder+'/index.html';
if(document.getElementById('hrefSEO'))document.getElementById('hrefSEO').href = dir+assetsFolder +'/seo/toc.html';
delete changeURL;
}
if (document.addEventListener){
document.addEventListener("DOMContentLoaded", changeURL, false);
} else {
document.attachEvent("onDOMContentLoaded", changeURL);
}
function afterLoad(){
checkPage();
setFocusOnFlash();
}
function setFocusOnFlash(){
var f=swfobject.getObjectById('content');
if (f) { f.tabIndex = 0; f.focus(); }
}
function getURLParam()
{
var returnObject = {};
var href = window.location.href;
if ( href.indexOf("?") > -1 )
{
var param = href.substr(href.indexOf("?"));
var arrayParam = param.split("&");
returnObject['assets'] = assetsFolder;
for ( var i = 0; i < arrayParam.length; i++ )
{
var value = arrayParam[i].split("=");
returnObject[value[0]] = value[1];
}
}
return returnObject;
}
var dir = "./files/";
var getURI = function(){
var URIArray = document.location.href.split('/');
URIArray.length = URIArray.length-1;
var URIstr = URIArray.join('/');
URIArray = null;
var URIarr = dir.split('/');
URIarr[0] = URIarr[0]=='.'?'':URIarr[0];
var dirStr = URIarr.join('/');
URIstr = URIstr+dirStr;
return URIstr;
}
var swfName = "flippingbook.swf?rnd=a920e3f104e299e21a8f93f76594fff6";
var ua = navigator.userAgent.toLowerCase(),
platform = navigator.platform.toLowerCase(),
UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
mode = UA[1] == 'ie' && document.documentMode;
var Browser = {
extend: Function.prototype.extend,
name: (UA[1] == 'version') ? UA[3] : UA[1],
version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
Platform: {
name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android|bada|symbian|palm|blackberry)/) || platform.match(/mac|win|linux/) || ['other'])[0]
},
Features: {
xpath: !!(document.evaluate),
air: !!(window.runtime),
query: !!(document.querySelector),
json: !!(window.JSON)
},
Plugins: {}
};
if(Browser.Platform.name == 'android' || Browser.Platform.name == 'ios') window.location = dir+mobileFolder+"/index.html";
if(Browser.Platform.name == 'webos' || Browser.Platform.name == 'bada' || Browser.Platform.name == 'symbian' || Browser.Platform.name == 'palm' || Browser.Platform.name == 'blackberry') window.location = dir+assetsFolder+"/seo/page1.html";
var flashvars = getURLParam();
var params = {baseURI: getURI(), base: dir, allowFullScreen: true, allowScriptAccess: "sameDomain", quality: "high", scale: "noscale",bgcolor:"FFFFFF"};
var attributes = {align: "middle"};
swfobject.embedSWF(dir + swfName, "content", "100%", "100%", "10.0.0", dir + "expressInstall.swf", flashvars, params, attributes);</script>
и
<body style="padding: 0px; margin: 0px; height:100%; width:100%;" onLoad="afterLoad()">
Я бы хотел сделать анимацию flash прозрачной при загрузке этой страницы в iframe, чтобы она не закрывала выпадающее меню ...