-
Chapter 7
Posted on July 26th, 2009 7 commentsChapter 7 covers the use of audio in Flash. In addition to discussing formats and compression, we walk through the creation of a sound managing class that can be re-used in future projects.
7 responses to “Chapter 7”
-
I found a small error on side 106
_loops- should be _loops–
Enjoying the book very much so far!
-
There is one other error in line 368 that was pointed out by a forum user. It should be new SoundTransform(_transform.volume, _transform.pan). As is, this will get caught in a recursive loop as it tries to call the accessor over and over again.
-
Sorry but I dont see anything resembling loops on or near line 106 in the SoundEngine.as
on line 368 just to clarify
should the complete line be
new SoundTransform(_transform.volume, _transform.pan);or
return new SoundTransform(_transform.volume, _transform.pan);
Also in it’s present form are these classes usable in Flash 9 framework?
Thanks struggling to figure this thing out.
-
Hi Jim,
I’m guessing he was referring to page 106 of the book, not to a line of code.As for the other correction, the problem was that I was originally returning:
return new SoundTransform(transform.volume, transform.pan);
and it should be:
return new SoundTransform(_transform.volume, _transform.pan);
Notice the addition of the underscores. When the code attempted to retrieve the volume and pan values, it would trigger a recursive call to the get transform accessor. It should return the values from the private variable instead. Make sense?
-
Chris, yes understand completely. Just wanted to clarify the return which made sense too but I wanted to make sure that wasn’t the cause of my errors while trying to implement this as a approach.
Thanks
-
There seems to be more to the small error I posted about a year ago (top post)…
Just to clarify – I refer to code line 350:
play(_offset, _loops–, _transform);
on book page 106.In the book _loops– is replaced by _loops-.
Well, neither is correct. It should be –_loops. I.e., the decrement should be before the function parameter is set. Otherwise _loops will stay the same and all loops will be infinite loops.
-
The font on this forum sure doesn’t help. The decrement operator is written like one long line — without space between the two minus symbols.
two minus: –
one minus: -
two minus with an extra space between: – -Murphy’s law, I guess
Leave a reply
-


