Discussion:
Flash sound channel limit
(too old to reply)
nausikaa
2010-02-28 13:32:08 UTC
Permalink
Hi

I am working on a flash app someone else has written and it uses up
all 32 audio channels.
Does anyone know how to prevent that from happening?
The app is a simple video player, it has a menu with 5 buttons, each
button loads and plays a
different movie. If you press the buttoms randomly 33 times, the whole
app goes mute.
I googled but didn't find anything useful about how to free flash
audio channels.
Thanks for any help!

gloria
Flasher
2010-03-01 13:02:01 UTC
Permalink
I need to see the button code, please


On Sun, 28 Feb 2010 05:32:08 -0800 (PST), nausikaa
Post by nausikaa
Hi
I am working on a flash app someone else has written and it uses up
all 32 audio channels.
Does anyone know how to prevent that from happening?
The app is a simple video player, it has a menu with 5 buttons, each
button loads and plays a
different movie. If you press the buttoms randomly 33 times, the whole
app goes mute.
I googled but didn't find anything useful about how to free flash
audio channels.
Thanks for any help!
gloria
nausikaa
2010-03-02 14:03:35 UTC
Permalink
Hello Flasher

The document class "MainClass" has a variable that is a chapter. Each
chapter has a button for itself and
subbuttons for the movies that are in that chapter, the buttons are a
class called "GenericButton".
The chapter has an event handler that is called when one of the movie
buttons is pressed, it is this code here:

private function movieSelected(ev:flash.events.Event):void{
var buttonClicked:GenericButton =
GenericButton(ev.currentTarget);
if (this.selectedButton !== buttonClicked){
var selectedMovie:*=null;
if (this.selectedButton !== null){
this.selectedButton.selected = false;
}
this.selectedButton = buttonClicked;
this.selectedButton.selected = true;
selectedMovie =
this.data.chapters[this.selectedChapter].movies[buttonClicked.id];
MainClass.ACTIVATED_BUTTON = buttonClicked;
this.dispatchEvent(new MovieEvent("movieSelected",
selectedMovie.file, selectedMovie.subtitles));
this.dispatchEvent(new HistoryEvent("addHistory", "",
selectedMovie));
}
return;
}

The MainClass also has a variable called video which is of type
VideoDisplay, which is set in the event handler "getMovieSelection"
which is also in the MainClass, the code is this:

private function getMovieSelection(movEvent:MovieEvent):void{
video.video = movEvent.movie;
video.subtitle = movEvent.subtitle;
video.showVideo();
video.addEventListener("showSub", subFunction);
video.addEventListener("hideSub", subFunction);
return;
}

Both event handlers, "getMovieSelection" as well as "movieSelected"
are called when you click the button in the menu that will play the
corresponding movie.
Let me know if you need more code.

Thanks for your help!
Post by Flasher
I need to see the button code, please
On Sun, 28 Feb 2010 05:32:08 -0800 (PST), nausikaa
Post by nausikaa
Hi
I am working on a flash app someone else has written and it uses up
all 32 audio channels.
Does anyone know how to prevent that from happening?
The app is a simple video player, it has a menu with 5 buttons, each
button loads and plays a
different movie. If you press the buttoms randomly 33 times, the whole
app goes mute.
I googled but didn't find anything useful about how to free flash
audio channels.
Thanks for any help!
gloria
nausikaa
2010-03-04 08:30:00 UTC
Permalink
Post by nausikaa
Hello Flasher
The document class "MainClass" has a variable that is a chapter. Each
chapter has a button for itself and
subbuttons for the movies that are in that chapter, the buttons are a
class called "GenericButton".
The chapter has an event handler that is called when one of the movie
        private function movieSelected(ev:flash.events.Event):void{
            var buttonClicked:GenericButton =
GenericButton(ev.currentTarget);
            if (this.selectedButton !== buttonClicked){
                                var selectedMovie:*=null;
                if (this.selectedButton !== null){
                    this.selectedButton.selected = false;
                }
                this.selectedButton = buttonClicked;
                this.selectedButton.selected = true;
                selectedMovie =
this.data.chapters[this.selectedChapter].movies[buttonClicked.id];
                MainClass.ACTIVATED_BUTTON = buttonClicked;
                this.dispatchEvent(new MovieEvent("movieSelected",
selectedMovie.file, selectedMovie.subtitles));
                this.dispatchEvent(new HistoryEvent("addHistory", "",
selectedMovie));
            }
            return;
        }
The MainClass also has a variable called video which is of type
VideoDisplay, which is set in the event handler "getMovieSelection"
        private function getMovieSelection(movEvent:MovieEvent):void{
            video.video = movEvent.movie;
            video.subtitle = movEvent.subtitle;
            video.showVideo();
            video.addEventListener("showSub", subFunction);
            video.addEventListener("hideSub", subFunction);
            return;
        }
Both event handlers, "getMovieSelection" as well as "movieSelected"
are called when you click the button in the menu that will play the
corresponding movie.
Let me know if you need more code.
Thanks for your help!
Post by Flasher
I need to see the button code, please
On Sun, 28 Feb 2010 05:32:08 -0800 (PST), nausikaa
Post by nausikaa
Hi
I am working on a flash app someone else has written and it uses up
all 32 audio channels.
Does anyone know how to prevent that from happening?
The app is a simple video player, it has a menu with 5 buttons, each
button loads and plays a
different movie. If you press the buttoms randomly 33 times, the whole
app goes mute.
I googled but didn't find anything useful about how to free flash
audio channels.
Thanks for any help!
gloria
Problem solved. There was a call that made a new FLVPlayback every
time you clicked on a movie.
Unnecessary because you can just change the movie of the existing
instance so creating it once is enough.

Continue reading on narkive:
Loading...