topical media & game development

talk show tell print

actionscript-book-IntrovertIM_HTML-html-template-index.template.cfg / cfg



  <!-- saved from url=(0014)about:internet -->
  <html lang="en">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>{application}</title>
  <script src="AC_OETags.js" language="javascript"></script>
  <script language="JavaScript">
          <!--
          // ------- Private vars -------
          var jsReady = false;
          var swfReady = false;
  
          // ------- functions called by ActionScript -------
          // called to check if the page has initialized and JavaScript is available
          function isReady() {
                  return jsReady;
          }
  
          // called to notify the page that the SWF has set it's callbacks
          function setSWFIsReady() {
                  // record that the SWF has registered it's functions (i.e. that JavaScript
                  // can safely call the ActionScript functions)
                  swfReady = true;
                  
                  updateStatus();
          }
          
          // called to notify the page of a new message
          function newMessage(value) {
                  // append the message text to the end of the transcript
                  document.forms["imForm"].transcript.value += "The Other Person: " + value + "\n";
          }
  
          // called to notify the page that the SWF user's availability (status) has changed
          function statusChange() {
                  updateStatus();
          }
  
          // ------- event handling -------
          // called by the onload event of the <body> tag
          function pageInit() {
                  // record that JavaScript is ready to go.
                  jsReady = true;
          }
  
          // called when the "Send" button is pressed; the value in the messageText text field
          // is passed in as a parameter.
          function sendMessage(message) {
                  if (swfReady)
                  {
                          // if the SWF has registered it's functions, add the message text to the
                          // local transcript, send it to the SWF file to be processed there, and clear
                          // the message text field.
                          document.forms["imForm"].transcript.value += "You: " + message + "\n";
                          document.forms["imForm"].messageText.value = "";
                          getSWF("{application}").newMessage(message);
                  }
          }
  
          // ------- utility functions -------
          // if the SWF has indicated it's ready for communication, calls the ActionScript
          // function to get the current "availability" status and writes it into the text field.
          function updateStatus() {
                  if (swfReady) {
                          var currentStatus = getSWF("{application}").getStatus();
                          document.forms["imForm"].status.value = currentStatus;
                  }
          }
  
          // Gets a reference to the specified SWF file by checking which browser is
          // being used and using the appropriate JavaScript.
          // Unfortunately, newer approaches such as using getElementByID() don't
          // work well with Flash Player/ExternalInterface.
          function getSWF(movieName) {
                  if (navigator.appName.indexOf("Microsoft") != -1) {
                          return window[movieName];
                  } else {
                          return document[movieName];
                  }
          }
          //-->
  </script>
  </head>
  
  <body onload="pageInit();">
  <script language="JavaScript" type="text/javascript">
  <!--
                  AC_FL_RunContent(
                                          "src", "{swf}",
                                          "width", "600",
                                          "height", "300",
                                          "align", "middle",
                                          "id", "{application}",
                                          "quality", "high",
                                          "bgcolor", "{bgcolor}",
                                          "name", "{application}",
                                          "allowScriptAccess","sameDomain",
                                          "type", "application/x-shockwave-flash",
                                          "pluginspage", "http://www.macromedia.com/go/getflashplayer"
          );
  // -->
  </script>
  <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                          id="{application}" width="600" height="300"
                          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
                          <param name="movie" value="{swf}.swf" />
                          <param name="quality" value="high" />
                          <param name="bgcolor" value="{bgcolor}" />
                          <param name="allowScriptAccess" value="sameDomain" />
                          <embed src="{swf}.swf" quality="high" bgcolor="{bgcolor}"
                                  width="600" height="300" name="{application}" align="middle"
                                  play="true"
                                  loop="false"
                                  quality="high"
                                  allowScriptAccess="sameDomain"
                                  type="application/x-shockwave-flash"
                                  pluginspage="http://www.macromedia.com/go/getflashplayer">
                          </embed>
          </object>
  </noscript>
          <form name="imForm" onsubmit="return false;">
                  <div>
                          The Other Person's status: <input type="text" name="status" value="" readonly="true" />
                  </div>
                  <div>
                          <textarea cols="60" rows="10" name="transcript" readonly="true" style="width: 600px; height: 200px;"></textarea>
                  </div>
                  <div>
                          <input type="text" name="messageText" value="" style="width: 500px" />
                          <input type="button" value="Send" onclick="sendMessage(this.form.messageText.value);" />
                  </div>
          </form>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.