[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


actionscript 3.0 progress/complete for multiple audio

Posted on 2008-11-17
Medium Priority
Last Modified: 2013-11-11
Is there a way to handle this sound loader where the onComplete is one function instead of 2? This way both sounds are loaded and then one onComplete is executed?

Also can the progress be combined so both sounds give back an overall progress on both?
a = new Sound();
			a.load(new URLRequest(mp3));
			b = new Sound();
			b.load(new URLRequest(mp3));
                        function onProgress(evt: ProgressEvent):void{
                        progVal = evt.bytesLoaded;
                        function onLoadComplete1(){
                        trace("sound 1 loaded");
                        function onLoadComplete2(){
                        trace("sound 2 loaded");

Open in new window

Question by:lexshine
LVL 39

Accepted Solution

blue-genie earned 2000 total points
ID: 22983964
hi, thinking out loud here.
in terms of combining the two.
you have two progress listeners.
so have each one call a method

something along these lines
//just for logic - code not tested.

function (firstVal, secondVal) {
var average:Number = (firstVal + secondVal)/2;
//base whatever display you're using on this average value;

then in terms of the complete listeners.

again, you could create a 3rd function which gets executed when both the others are done.
so set variables

var firstDone:Boolean = false;

then set it to true in the complete handler

if both are true call the third function.


Author Closing Comment

ID: 31517727

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question