3 Replies Latest reply on May 23, 2006 5:35 PM by asm0d

    Tip: Using JavaScript with Breeze Presentations

    asm0d Level 1
      Hi all,

      One of the reoccuring comments our alpha testers had was that there was no "close" button on the last slide of our Breeze presentations. Of course, Breeze doesn't give you any obvious ways to close the browser window, other than clicking the "x" in the upper right corner. But, since the Breeze viewer is contained within an HTML shell, the solution is really quite simple: use the "fscommand" global in Actionscript to activate a script embedded in the HTML page.

      How-to
      (1) Make a simple Flash movie, with a button. In this case, ours consisted of a small button that said "quit". In the first frame of the movie, add the following actionscript event handler:

      btnName.onRelease = function () {
      fscommand ("quit");
      }


      (2) Insert this button's *.swf file in the appropriate PowerPoint slide, and output the presentation to Breeze.

      (3) Find the "index.htm" file in the Breeze output, and open it in notepad.

      (4) Find the function "Sub SlideContent_FSCommand" in the vbscript section, and add the following code to the 'select case' function:

      case "quit" window.close

      (5) In case you're using something that doesn't understand vbscript (and I hope you are ) add the following function at the top of the javascript section:


      function SlideContent_DoFSCommand (command, args)
      {
      window.close ();
      }


      Save the index.htm file, then reopen it in your browser like always. When the user clicks the button in the Breeze presentation, it will send the "quit" command to the browser, which will either handle it in vbScript or JavaScript.

      Most of the time, we leave out the vbScript altogether so that all fscommands are handled by a big "case" statement in JavaScript. The only real issue I've run into doing this is that some JS methods for the Window object (and some Document methods, like .write() ) tend to fail.



      Cheers!

      ~Marc B