I have been tasked w/ creating a new interface for something at work.
I need to have flash communicate w/ some js that is on the same page as my
movie. (right now the actionscript will only display what is returned in a
dynamic text box.
the js is written by someone else so im not even sure if im calling it right.
but, in the end the button in flash should load the "next" content into an
iframe.
as:
js_next = ExternalInterface.call("buttonClick", "next");
link = js_next;
the js:
function buttonClick(id) {
if (buttonStatus.charAt(whichButton(id)) == '0') return false;
var currentFrame = new String(document.getElementById('contentFrame').con
tentWindow.document.location)
if (currentFrame.indexOf("glossary.htm") > -1 ||
currentFrame.indexOf("help.htm") > -1) {
document.getElementById('contentFrame').src = returnFrame
}else{
var curSize = new Number(document.getElementById('narrationFrame').o
ffsetHeight)
if (curSize < 215) {
document.getElementById('contentFrame').contentWin dow.courseReview();
}
eval(document.getElementById('contentFrame').conte
ntWindow.document.getElementById('pageVariableScri pt').innerHTML);
switch (id) {
case 'back' :
buttonEnableAll();
if (back == '') {
buttonClick('exit');
}else{
document.getElementById('contentFrame').contentWin dow.navigate(thisFolder +
'/' + back);
}
break;
case 'reload' :
buttonEnableAll();
document.getElementById('contentFrame').contentWin dow.location.reload();
break;
case 'next' :
buttonEnableAll();
// Process test bank Next Frame
if (next == '*') {
var testBank = getCookie("testBank");
if (testBank != '' && testBank != null) {
var theFrames = testBank.split(";");
next = theFrames.shift();
testBank = theFrames.join(";");
setCookie("testBank", testBank);
}else{
next = 'postresults.htm'
}
}
if (next == '') {
buttonClick('exit');
}else{
document.getElementById('contentFrame').contentWin dow.navigate(thisFolder +
'/' + next);
}
break;
case 'glossary' :
returnFrame = new String(document.getElementById('contentFrame').con
tentWindow.document.location)
document.getElementById('contentFrame').src = 'glossary.htm'
break;
case 'audio' :
if (isNetscape()) {
var currSrc = document.images['btnAudio'].src
}else{
var currSrc = document.getElementById('btnAudio').src
}
currSrc = currSrc.toLowerCase().replace(/\//,"/");
var newSrc = currSrc.substring(0, currSrc.lastIndexOf('/') + 1)
if (currSrc.indexOf('audioon') > -1) { setAudio('N', 'interface'); newSrc +=
'audiooff.gif' }
if (currSrc.indexOf('audiooff') > -1) { setAudio('D', 'interface'); newSrc +=
'audiotext.gif' }
if (currSrc.indexOf('audiotext') > -1) { setAudio('Y', 'interface'); newSrc +=
'audioon.gif' }
replaceImage('btnAudio', newSrc);
buttonClick('reload');
break;
case 'exit' :
if (next == '') {
document.getElementById('contentFrame').contentWin dow.SCORM_Complete();
}else{
document.getElementById('contentFrame').contentWin dow.SCORM_Incomplete();
}
window.opener.close();
break;
case 'help' :
returnFrame = new String(document.getElementById('contentFrame').con
tentWindow.document.location)
document.getElementById('contentFrame').src = thisFolder +
'/../../_Common/help.htm'
break;
}
return true;
}
}
yachts99 - 07 Jun 2006 08:41 GMT
Double quotes around "next"?
getURL("javascript:buttonClick("next")" );
gswertfeger - 26 Jun 2006 18:26 GMT
This one isn't very far off. I'm hoping that you have already figured it out by
now, but for those who stumble upon this page, the javascript
getURL("javascript:buttonClick('next')" ); is missing a semicolon should look
like this to work.
getURL("javascript:buttonClick('next');" );