Last active
May 10, 2017 18:39
-
-
Save vishnun/d840ca27dea74c455e3950de04940330 to your computer and use it in GitHub Desktop.
Way to communicate from flash to captivate using js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright [2008] Adobe Systems Incorporated. All rights reserved --> | |
<!-- saved from url=(0013)about:internet --> | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title></title> | |
<script src="standard.js" type="text/javascript"></script> | |
</head> | |
<link rel="stylesheet" type="text/css" href="captivate.css" /> | |
<body bgcolor="#ffffff"> | |
<div id="diffusionContent"></div> | |
<div id="diffusion"></div> | |
<script type="text/javascript"> | |
/* | |
function loadMicroDiffusion(callback) { | |
console.log("loading.."); | |
var video = '<embed src="diffusion_micro-modified.swf" id="diffusion" quality="high" scale="exactfit" width="600" height="450" name="squambido" align="middle" allowscriptaccess="always" style=" display: block; z-index: 1; position: absolute;" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>'; | |
var diffusionContent = document.createElement("div"); | |
diffusionContent.innerHTML = video; | |
document.getElementsByTagName("body")[0].appendChild(diffusionContent); | |
if (callback) { | |
setTimeout(function() { | |
document.getElementById("diffusion").playAnimation(); | |
callback(); | |
}, 2000); | |
} | |
} | |
*/ | |
function loadMicroDiffusion(callback) { | |
console.log("loading.."); | |
var swfo = new SWFObject("diffusion_micro-modified.swf", "diffusion", "640", "400", "10", "#CCCCCC"); | |
swfo.addParam("allowScriptAccess", "always"); | |
swfo.addParam("pluginspage", "http://www.macromedia.com/go/getflashplayer") | |
swfo.write("diffusionContent"); | |
if (callback) { | |
setTimeout(function() { | |
document.getElementById("diffusion").playAnimation(); | |
callback(); | |
}, 2000); | |
} | |
} | |
function thisMovie(movieName) { | |
if (navigator.appName.indexOf("Microsoft") != -1) { | |
return window[movieName] | |
} else { | |
return document[movieName] | |
} | |
} | |
function captivatePause() { | |
console.log("Pause.."); | |
if(thisMovie('diffusion').pauseAnimation){ | |
thisMovie('diffusion').pauseAnimation(); | |
window.cpAPIInterface.pause(); | |
} | |
} | |
function pauseAfter(timeInSec) { | |
var timeInMS = timeInSec > 10? 10000 : timeInSec*1000; | |
setTimeout(captivatePause, timeInMS); | |
} | |
function captivatePlay() { | |
console.log("Play.."); | |
if(thisMovie('diffusion').playAnimation){ | |
thisMovie('diffusion').playAnimation(); | |
} | |
window.cpAPIInterface.play(); | |
} | |
</script> | |
<div id="CaptivateContent"> | |
</div> | |
<script type="text/javascript"> | |
var strURLFull = window.document.location.toString(); | |
var intTemp = strURLFull.indexOf("?"); | |
var strURLParams = ""; | |
if (intTemp != -1) { | |
strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length); | |
} | |
var so = new SWFObject("flash-trial.swf", "Captivate", "1025", "674", "10", "#CCCCCC"); | |
so.addParam("quality", "high"); | |
so.addParam("name", "Captivate"); | |
so.addParam("id", "Captivate"); | |
so.addParam("wmode", "window"); | |
so.addParam("bgcolor", "#ffffff"); | |
so.addParam("seamlesstabbing", "false"); | |
so.addParam("menu", "false"); | |
so.addParam("AllowScriptAccess", "always"); | |
so.addVariable("variable1", "value1"); | |
if (strURLParams != "") { | |
so.addVariable("flashvars", strURLParams); | |
} | |
so.setAttribute("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"); | |
so.write("CaptivateContent"); | |
</script> | |
<script type="text/javascript"> | |
document.getElementById('Captivate').focus(); | |
document.Captivate.focus(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment