Can I link flash movie with jQuery Shadowbox overlay?
2 answers
Of course Flash can call methods in Javascript using ExternalInterface. The syntax is pretty simple in, say, Javasacript:
function methodInJS(name) {
alert("Hello to " + name);
return 17;
}
Then, in ActionScript, you have to call:
var myName:String = "David";
var result:Number = ExternalInterface.call("methodInJS", myName);
trace("Result from JS call is: "+result);
+3
a source to share
Yes, use ExternalInterface
In HTML format, create a shadow box like this:
<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
skipSetup: true
});
function openShadowbox(content, type){
Shadowbox.open({
content: content,
player: type,
title: "Welcome",
height: 350,
width: 350
});
};
</script>
Then, in your ActionScript:
if(ExternalInterface.avilable){
try{
ExternalInterface.call("openShadowbox", "<h1>Welcome to my website!</h1>", "html");
}catch(error:Error){
trace(error);
}
}
+1
a source to share