0 Replies Latest reply on Jun 2, 2006 6:58 AM by organicdigital

    flash communicatio w/ javascript problems

    organicdigital
      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.

      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').contentWindow.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').offsetHeight)
      if (curSize < 215) {
      document.getElementById('contentFrame').contentWindow.courseReview();
      }
      eval(document.getElementById('contentFrame').contentWindow.document.getElementById('pageV ariableScript').innerHTML);
      switch (id) {
      case 'back' :
      buttonEnableAll();
      if (back == '') {
      buttonClick('exit');
      }else{
      document.getElementById('contentFrame').contentWindow.navigate(thisFolder + '/' + back);
      }
      break;
      case 'reload' :
      buttonEnableAll();
      document.getElementById('contentFrame').contentWindow.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').contentWindow.navigate(thisFolder + '/' + next);
      }
      break;
      case 'glossary' :
      returnFrame = new String(document.getElementById('contentFrame').contentWindow.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').contentWindow.SCORM_Complete();
      }else{
      document.getElementById('contentFrame').contentWindow.SCORM_Incomplete();
      }
      window.opener.close();
      break;
      case 'help' :
      returnFrame = new String(document.getElementById('contentFrame').contentWindow.document.location)
      document.getElementById('contentFrame').src = thisFolder + '/../../_Common/help.htm'
      break;
      }
      return true;
      }
      }