Diff for /books/www/chapters/ch05.html between versions 1.12 and 1.19

version 1.12, 2002/12/11 18:57:10 version 1.19, 2002/12/17 13:13:19
Line 1 Line 1
       <link rel="prev" href="http://books.mozdev.org/chapters/ch04.html" />
       <link rel="next" href="http://books.mozdev.org/chapters/ch06.html" />
   
     <style type="text/css">      <style type="text/css">
       div.c15 {font-weight: bold; text-align: center}        div.c15 {font-weight: bold; text-align: center}
       div.c14 {text-align: center}        div.c14 {text-align: center}
Line 1268  retval=OK; Line 1271  retval=OK;
     Mozilla instantiates a Mozilla sound component and plays a      Mozilla instantiates a Mozilla sound component and plays a
     sound with it. Go ahead and try it. Example 5-11<a name=      sound with it. Go ahead and try it. Example 5-11<a name=
     "77032"></a> <i>Scripting components from HTML</i></p>      "77032"></a> <i>Scripting components from HTML</i></p>
<pre><xmp>
 &lt;html&gt;<html>
 &lt;head&gt;  <head>
 &lt;title&gt;Sound Service Play Example&lt;/title&gt;    <title>Sound Service Play Example</title>
 &lt;/head&gt;    <script>
 &lt;body&gt;      function play() {
 &lt;script&gt;        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");        var sample = Components.classes["@mozilla.org/sound;1"].createInstance();
   var url = Components.classes&lt;/td&gt;["@mozilla.org/network/standard-        sample = sample.QueryInterface(Components.interfaces.nsISound);
       url;1"].createInstance( );        const SND_NETWORK_STD_CID = "@mozilla.org/network/standard-url;1";
   url = url.QueryInterface(Components.interfaces.nsIURL);        const SND_I_URL           = "nsIURL";
   url.spec = "resource:/res/samples/test.wav";        const SND_URL             = new  C.Constructor(SND_NETWORK_STD_CID, SND_I_URL);
   var sample = Components.classes&lt;/td&gt;["@mozilla.org/sound;1"].createInstance( );        var url                   = new SND_URL();
   sample = sample.QueryInterface(Components.interfaces.nsISound);        url.spec                  = 'http://jslib.mozdev.org/test.wav';
 &lt;/script&gt;        sample.play(url);
 &lt;form name="form"&gt;      }
   &lt;input type="button" value="Play Sound" onclick="sample.play(url);"&gt;    </script>
 &lt;form&gt;  </head>
 &lt;/body&gt;  <body>
 &lt;/html&gt;    <form name="form">
</pre>      <input type="button" value="Play Sound" onclick="play();">
     </form>
   </body>
 </html>
 </xmp>
     <p>As in <a href="#77030">Example 5-10</a>, the classes[ ]      <p>As in <a href="#77030">Example 5-10</a>, the classes[ ]
     array on the special Mozilla <tt>Components</tt> object refers      array on the special Mozilla <tt>Components</tt> object refers
     to a particular component-in this case, the <tt>sound</tt>      to a particular component-in this case, the <tt>sound</tt>

Removed from v.1.12  
changed lines
  Added in v.1.19


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>