<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>args is a global var. In a script function (think subroutine rather than function) you should snap off the args into vars that won’t collide with anything else, because if you then call another function from that function, args will be the args sent to the second function. Once that’s done, and you’re back in the first function, args will hold values from the second function call. I don’t use functions so often: sometimes it seems better to have a global event handler, and fire custom events from within the code.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='margin-left:36.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> xerte-bounces@lists.nottingham.ac.uk [mailto:xerte-bounces@lists.nottingham.ac.uk] <b>On Behalf Of </b>Dave Burnett<br><b>Sent:</b> 04 February 2011 17:02<br><b>To:</b> Xerte list<br><b>Subject:</b> [Xerte] Re: Problem looping sound controlled by script - Xerte 2 desktop<o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-left:36.0pt'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>I've gotten into the habit of fully qualified paths.<br><br>_level0.engine.fcommonPagesetup(arg);<br><br>If you have multiple functions and/or are using asfunctions as well, funny things happen, especially to the args[]<br><br> <br><br><br><o:p></o:p></span></p><div class=MsoNormal align=center style='margin-left:36.0pt;text-align:center'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><hr size=2 width="100%" align=center id=stopSpelling></span></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From: maryann@moberg.com<br>Date: Fri, 4 Feb 2011 11:56:31 -0500<br>To: xerte@lists.nottingham.ac.uk<br>Subject: [Xerte] Re: Problem looping sound controlled by script - Xerte 2 desktop<br><br>Thanks for suggestion, Dave.  We run all of our xerte rlo files from a flash application that plays in the browser.  I've found that inFunc scripts work in preview, but don't when played in our flash wrapper.  Didn't investigate because it was easier just to duplicate the code. Another layer of Flash sitting under the xerte engine confusing things?  Now that I have a real reason, I think I'll put some time into figuring it out.  <br><br>Tried to use the onLoad event on the sound icon but it never fired.<br><br>Tried putting the load call in one script and the play call in a separate script but that magic didn't work.  <br><br>Tried setting the isStreaming arg of the loadSound call to true and that actually worked but then I lost looping which was the whole reason I started down this path.<br><br>hmmmm... I'll play around with this.<br>Thanks<o:p></o:p></span></p><div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>On Fri, Feb 4, 2011 at 11:14 AM, Dave Burnett <<a href="mailto:d_b_burnett@hotmail.com">d_b_burnett@hotmail.com</a>> wrote:<o:p></o:p></span></p><div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><SCR isFunc="1" name="fdoSound"><br><br>onLoad event<br><SCR>fdoSound(myargs);<br><br>??<o:p></o:p></span></p><div class=MsoNormal align=center style='margin-left:36.0pt;text-align:center'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From: <a href="mailto:maryann@moberg.com">maryann@moberg.com</a><br>Date: Fri, 4 Feb 2011 11:01:40 -0500<br>To: <a href="mailto:xerte@lists.nottingham.ac.uk">xerte@lists.nottingham.ac.uk</a><o:p></o:p></span></p><div><div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br>Subject: [Xerte] Re: Problem looping sound controlled by script - Xerte 2 desktop<br><br>Thanks, Julian, you're absolutely right.  <br><br>But now I'm trying to figure out how to implement this without a button for each task.  When I read the flash documentation it's all about defining a named or anonymous function that is invoked onLoad, which we can't do in xerte, right?  <br><br><o:p></o:p></span></p><div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>On Fri, Feb 4, 2011 at 4:26 AM, Julian Tenney <<a href="mailto:Julian.Tenney@nottingham.ac.uk">Julian.Tenney@nottingham.ac.uk</a>> wrote:<o:p></o:p></span></p><div><div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'>Is the sound loaded before you call start()? It might need to load before the method works. Try mocking up an interaction with a button to load the sound, a button to make it play, see if that works. In the engine I handle onLoad to control the autoPlay setting, so I think that’s the right approach.</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br></span><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'> </span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm 0cm 0cm;border-color:-moz-use-text-color -moz-use-text-color'><p class=MsoNormal style='margin-left:72.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a> [mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Mary Ann Ahearn<br><b>Sent:</b> 04 February 2011 07:03<br><b>To:</b> Xerte discussion list<br><b>Subject:</b> [Xerte] Re: Problem looping sound controlled by script - Xerte 2 desktop</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p></div><div><div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Hi Julian,<br><br>Things just got weird using this technique to control sound.  Haven't  had time to investigate yet, but thought I'd ask in case the answer is as easy for you as the last one was.<o:p></o:p></span></p><div style='margin-left:30.0pt'><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>soundIcon.sound.stop(); <br>soundIcon.loadSound(FileLocation + 'mySoundFile.mp3');<o:p></o:p></span></p></div><div><div style='margin-left:30.0pt'><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>soundIcon.sound.start(0,100);<o:p></o:p></span></p></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br>Accessing the flash sound object with these calls works fine when I play the rlo file in preview mode. iI also works when I play it from a flash swf file that loads it with this:<br>     attachMovie('Xerte', 'myRLO', 0);<br><br>But if I publish the rlo and try to play it in a browser, or if I play my flash "wrapper" in a browser I don't hear these sound files.  I do hear the other sounds in my rlo that I'm playing in the standard way.<br><br>Any ideas as to what's going on?<br><br>Thanks a million!<br>ma<o:p></o:p></span></p><div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>On Tue, Feb 1, 2011 at 11:20 AM, Mary Ann Ahearn <<a href="mailto:maryann@moberg.com">maryann@moberg.com</a>> wrote:<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Indeed it is!<br>Thanks<br>ma<o:p></o:p></span></p><div><div><div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>On Tue, Feb 1, 2011 at 10:56 AM, Julian Tenney <<a href="mailto:Julian.Tenney@nottingham.ac.uk">Julian.Tenney@nottingham.ac.uk</a>> wrote:<o:p></o:p></span></p></div></div><blockquote style='border:none;border-left:solid windowtext 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><div><div><div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'>Easy.</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'> </span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'>Access the underlying sound object, mySoundIcon.sound and control it directly with the Sound object’s methods</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'> </span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'>myIcon.sound.start(offset, loopCount);</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif";color:#1F497D'> </span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p><div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm 0cm 0cm;border-color:-moz-use-text-color'><p class=MsoNormal style='margin-left:108.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a> [mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Mary Ann Ahearn<br><b>Sent:</b> 01 February 2011 15:53<br><b>To:</b> Xerte discussion list<br><b>Subject:</b> [Xerte] Problem looping sound controlled by script - Xerte 2 desktop</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p></o:p></span></p></div><div><div><p class=MsoNormal style='margin-left:108.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='margin-left:108.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>I was feeling smug enough about controlling sound via script yesterday to dare to post an answer to someone's question!!  Ha!  The gods don't like hubris.<br><br>Today everything is different.<br><br>I've got a button that plays a sound when clicked. I'd like the sound to loop and the button to toggle it on and off<br><br>It seems to forget its loop value when I start controlling it via script.<br><br>mySoundIcon.play();<br><br>However if I just put the sound icon under a button icon and set it to play =1 and loop = 5, then the looping works and all is fine.  I can even stop it and reset it without any problems.  Just can't manage to play it from script more than one time.<br><br>Tried putting an onSoundComplete event to reset it and play it but it just went mad and looped very bizarrely without ever waiting to finish.<br><br>Then I tried the getSound route but can't seem to get the timing right so this always returns undefined.<br><br>Any ideas?  I think I must be missing something very simple.<br><br>Thanks!<br>ma<o:p></o:p></span></p></div></div></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. <o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. <o:p></o:p></span></p></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>_______________________________________________<br>Xerte mailing list<br><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><o:p></o:p></span></p><div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br><br>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br><br>This message has been checked for viruses but the contents of an attachment<br>may still contain software viruses which could damage your computer system:<br>you are advised to perform your own checks. Email communications with the<br>University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></span></p></div></blockquote></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p></div><p class=MsoNormal style='margin-left:72.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <o:p></o:p></span></p></div></div></div></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br>_______________________________________________<br>Xerte mailing list<br><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br><br>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br><br>This message has been checked for viruses but the contents of an attachment<br>may still contain software viruses which could damage your computer system:<br>you are advised to perform your own checks. Email communications with the<br>University of Nottingham may be monitored as permitted by UK legislation.<br><br><o:p></o:p></span></p></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p></div></div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>_______________________________________________ Xerte mailing list <a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a> <a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. <o:p></o:p></span></p></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br>_______________________________________________<br>Xerte mailing list<br><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br><br>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br><br>This message has been checked for viruses but the contents of an attachment<br>may still contain software viruses which could damage your computer system:<br>you are advised to perform your own checks. Email communications with the<br>University of Nottingham may be monitored as permitted by UK legislation.<br><br><o:p></o:p></span></p></div><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br><br>_______________________________________________ Xerte mailing list Xerte@lists.nottingham.ac.uk http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. <o:p></o:p></span></p></div></body></html>