Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




LoadSound(mp3) --> OnSoundComplete?



Newbie here. I created a jukebox that will play through 8 tracks (about 5min ea.). The tracks can be played by clicking on a button that calls the following function:

initiateSound = function(nmbr){
thisTrack = nmbr
testSound = new Sound();
testSound.loadSound("audio/sp" + showNmbr + "_0" + nmbr + ".mp3");
testSound.start(0);
}

One of the main things I need this player to do is start the next track after the prior has completed. I could not get onSoundComplete to work for me. So instead, I set up an onEnterFrame event to check if the postion of the track was at 100%...if so, load the next track into the same variable and start playing as show below:

if (_root.thisTrack <= 7){
if (_root.soundPct >= 100){
stopAllSounds();
_root.initiateSound.call(nmbr,thisTrack+1);
_root.resetJumper.call();
}
}

Everything was working great!!! ... then I uploaded the files to the server. What then happened was that the player would run through all the tracks w/in a second and not play any of them ... almost like it was reading that all track positions were at 100%. I could only get 2 of the tracks to play by selecting their track number.

Can anyone help? Is onSoundComplete not a good event handler for loaded mp3 files? Any help appreciated!!!



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 11-16-2004, 06:11 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Can You Use OnSoundComplete When You Do That?
Does anybody know the answer to that? Whenever I try to do that it automatically skips to the next frame.

Onsoundcomplete
how is it possible so that when I use onSoundComplete it goes to a different frame which is where another sound track is? or is there an easier different way i can do this? each track is on a different frame and is loaded from an external swf. thank you for any help that you can offer to me

How To Use OnSoundComplete?
Like i already said i am a newbie with Action Script.
How do you use this OnSoundComplete??(Its for a another project)

Thanksss

Onsoundcomplete
Well I have this problem with my musicplayer, I want it to load another song as soon as it is done playing.

I looked on the onSoundComplete action but I didn't seem to work
could someone explain it to me or come up with another solution?

OnSoundComplete
How or where can i use onSoundComplete? I have a small loop which is being looped for about 50 times from the library in the root level. As soon as the loop is finished, I want another sound to load on the root level from the library again giving it another track effect. Please help
Rgds
Bhaskee

Help With OnSoundComplete
im not really sure what i did wrong, but im creating something that sort of plays a playlist of mp3s.
when going from track 1 to track 2 it works fine, but from there it wont play to track 3 and beyond. (if i start on track 1, it'll play tracks 1 and 2; if i start on track 2 it will play 2 and 3; etc.)
how can i get it to play tracks 1-13 consecutively? or if you click track 2, have it play tracks 2-13?
i attached both sets of actionscript in the buttons so maybe someone can help me out. thanks a lot.

BUTTON 1

Code:
on (press) {
fw02.stop();
fw03.stop();
fw04.stop();
fw05.stop();
fw06.stop();
fw07.stop();
fw08.stop();
fw09.stop();
fw10.stop();
fw11.stop();
fw12.stop();
fw13.stop();
playing=false;
fw01 = new Sound();
fw01.loadSound("01.mp3", true);
//Play Button

if (playing!=true){
fw01.stop();
playing=false;
_root.fw01.start();
playing=true;
_root.myTextBox="Derivative Opener"
}
_root.fw01.onSoundComplete = function() {
playing=false;
fw02 = new Sound();
fw02.loadSound("02.mp3", true);
_root.fw02.start();
playing=true;
_root.myTextBox="Lusitania"
}

BUTTON 2

Code:
on (press) {
fw01.stop();
fw03.stop();
fw04.stop();
fw05.stop();
fw06.stop();
fw07.stop();
fw08.stop();
fw09.stop();
fw10.stop();
fw11.stop();
fw12.stop();
fw13.stop();
playing=false;
fw02 = new Sound();
fw02.loadSound("02.mp3", true);
//Play Button

if (playing!=true){
fw02.stop();
playing=false;
_root.fw02.start();
playing=true;
_root.myTextBox="Lusitania"
}
_root.fw02.onSoundComplete = function() {
playing=false;
fw03 = new Sound();
fw03.loadSound("03.mp3", true);
_root.fw03.start();
playing=true;
_root.myTextBox="Letter Of Intent"
}
}

OnSoundComplete
I am attempting to build a computer based training module system with 2004 professional, where each screen has audio, which on completion will move to the next screen. Now in order to make the visible parameter available, I'm having to do these in a forms based presentation instead of a slide based presentation. I'm having trouble getting the screens to transition based on completion of the sound event.

Here's a copy of the actionscript generated by the behaviors so far for the screen I am trying to transition out of:

on (reveal) {
// Transition behavior
if (!eventObj.target._isSlide || (eventObj.target._isSlide && eventObj.target.currentSlide)) {
mx.transitions.TransitionManager.start (eventObj.target,
{type:mx.transitions.Fade,
direction:0, duration:0.5, easing:mx.transitions.easing.None.easeNone,
param1:empty, param2:empty});

eventObj.target.__transitionManager._triggerEvent = eventObj.type;
}
// End Transition behavior


//Play Internal Sound Behavior
if(_global.Behaviors == null)_global.Behaviors = {};
if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
if(typeof this.createEmptyMovieClip == 'undefined'){
this._parent.createEmptyMovieClip('BS_PK01_module_ title',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.PK01_module_title = new Sound(this._parent.BS_PK01_module_title);
} else {
this.createEmptyMovieClip('_PK01_module_title_',ne w Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.PK01_module_title = new Sound(this.BS_PK01_module_title);
}
_global.Behaviors.Sound.PK01_module_title.attachSo und("PK01_module_title");
if (true) {
_global.Behaviors.Sound.PK01_module_title.start(0, 1);
}
//End Behavior

}


Where do I place the script for onSoundComplete and how do I write it? I've already looked at how to write a onSoundComplete script and it doesn't seem to work here.

OnSoundComplete ?
In my movie I load my voice overs dynamically with with this code;

Code:
_root.stop();
// Load voice
VSound = new Sound(Voice1_mc);
VSound.loadSound("Voices/Voice1.mp3", true);
// zero offset, repeat 10 times
VSound.start(0, 0);

VSound.onSoundComplete = function() {
_root.gotoAndPlay("v1");
};
I have several voices that play Voice1 through Voice13. Now on the main time line I also have a skipIntro button with this action on it

Code:
on (release) {
VSound.Stop()
_root.gotoAndPlay ("Earn")
}
Now if Voice1 thru 13 are playing when I click my button, the playhaed jumps to the correct frame but then jumps back to were the current voice is playing. If I click the skipInto button after the voice is playing the play head jumps to the correct fram and then continues to play correctly.

How can make my skipInto button function correctly all the time.

OnSoundComplete Help
Hello all,

I need some assistance. What I am attempting to do is use the onSoundComplete function with a twist, I would like to be able to add an additional two seconds to the function. Refer to code below:

true_twoButton.onPress = function() {
audio_threeButton.gotoAndStop(3);
false_twoButton.gotoAndStop(2);
this.gotoAndStop(2);
rightMC.gotoAndStop(2);
_root.mySound.stop();
_root.mySound.attachSound("g239");
_root.mySound.start("g239");
_root.mySound.onSoundComplete = function() {
_root.gotoAndPlay("next3");
}

As it is, this works great, but is there a way to get it to implement the gotoAndPlay two seconds after the sound completes?

I am using FLASH MX.

any assistance would be greatly appreciated.

Cheers

OnSoundComplete
Hello,

I had a post in the Sound help forum, but thought I would post here too.

My project is just a basic slide show. Talk about the picture shown and then go to the next scene to talk about the next picture so on for about 20 scenes.

My script is below, the actionscript is placed where I want the audio to start playing (frame 8)if this helps:

lessonMP3 = new Sound();
lessonMP3.loadSound("audio/SLSS-09.10.01.mp3", true);
lessonMP3.onSoundComplete = function(){
gotoAndPlay("next");
}

Where "next" is a label. The label dosen't work because on the next scene it takes it back to "next" on the first scene. However, on the previous/original scene it didn't play the whole audio any way. Just the number of frames the scene is setup at. This is just my last attempt using the "next" label as I struggle to get this working.

Thanks in advance.

OnSoundComplete?
Hi

First of all, Im dutch so don't mind the language problems

I made a flash site and i got 2 seperate mp3s. One to play during the intro and the other to loop immediatly after the first stopped. So how do i get to loop file number 2 across scenes immediatly when number one stops? I've tried some commands like onsoundcomplete but i can't get them to work.

I know it's a big favour but would you please write me a script and tell me where to paste it into?

Here are some urls:
http://jtm-events.fol.nl/JTM-Intro.mp3 (first, during intro)
http://jtm-events.fol.nl/Loopie.mp3 (second, looping during movie, across scenes aswell)

OnSoundComplete?
ok, i made an audioplayer, and i loaded external mp3s using the mySound.loadSound("url",streaming); method. is there anyway to detect when the song is over? i want to make it go on to the next song on the list, but it just isn't happening.

OnSoundComplete
I'm a graphics artist so am fine with animation but crap with actionscript - please help! I'm creating a Flash site to promote a music CD. The site has a 'Play Sample' button which plays a single track whilst a looping animation appears. When the track finishes I want the movie to continue to the next frame (or a specific frame number) to take the viewer to the 'buy now' page.

I guess the answer is simple but as I say, I havn't got my head round actionscript yet!

OnSoundComplete
I am not a guru when it comes to actionscript, but if anone can help me figure this out it would make my day. I have an mp3 player that I want to loop songs...it doesn't right now. Here is the actionscript I know I need to change, but I can't figure out how...I've looked through a ton of tutorials and still don't get it.

Here we go:

_root.createEmptyMovieClip("sound_mc", 1);
_global.song_nr = random(songfile.length);
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};


MovieClip.prototype.songStarter = function(file, name, band) {
if (this.sound_obj) {
this.sound_obj.play();
delete this.sound_obj;
}
this.sound_obj = new Sound(this);
this.sound_obj.loadSound(file, true);
this.onEnterFrame = function() {
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text = name+" / "+band;
timeInterval = setInterval(timer, 1000, this.sound_obj);
} else {
this._parent.display_txt.text = "loading...";
}
};
this.sound_obj.onSoundComplete = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);

I think I need to do something with the onSoundComplete here at the bottom, but like i said, I just can't seem to get it. Any way if any of you geniuses out there can help a dumb newbie it would make my day. Thanks

OnSoundComplete...
I have a button on the main timeline with actionscript attached to the button itself:


Code:
onClipEvent(enterFrame) {
_global.k1 = new Sound(this);
k1.attachSound("K1");
}
I have other code in there, it all works. Basically I just have a sound attached to a movie clip. But I control it in an action on the main timeline with:


Code:
k1.onSoundComplete = trace("inside 1");
k1.start();
Everything works except that it prints out "inside 1" as soon as the sound starts playing (not when it stops). I want it to run a function when the sound is finished, but it runs it as soon as the sound starts playing. I thought maybe I should put it on the button actionscript... but that doesn't work at all. Where am I going wrong with this?

Help With OnSoundComplete
I'm having a very strange problem with on sound complete. It seems that my handler for the Event.SOUND_COMPLETE is not being called??

I'm just gonna describe the steps involved from beginning to the time the handler should be called. I might be doing something silly that a fresh pair of eyes can spot.

First off in my main document class I do the following. I create 4 channels movieClips, add them to the stage and pop them in an array.


Main

ActionScript Code:
var channel:Object=getDefinitionByName("Channel")  as  Class;
for (var i=0; i < noOfChannels; i++) {

var mc:MovieClip=new channel();
addChild(mc);
channels.push(mc);

The next process is in a class named masterChannel. When a play button is pressed I iterate through all the channels in the channel array on the main document and call a play function on each of them (kinda like a primitive observer pattern)

master channel


ActionScript Code:
public function playPressed(e:MouseEvent) {

            var c=this.parent;
            var channels=c.channels;
            for each (var obj in channels) {
                obj.playAudio();

            }
        }


Finally in my channel class (where the magic is not happening )

Channel constructor


ActionScript Code:
public class Channel extends MovieClip {
       

       

        // Every Channel has  channel,sound and transfrom object'
        public var sndChannel:SoundChannel
       
        public var sound:Sound
        public var sndTransform:SoundTransform
        public var currentSound:int=0;
        // An Array Of Selectable audio file for this channel;
        public var tracksArray=[];
        public var channelType;

        // Channel Constructor Class
        public function Channel(main,ct) {
           
            sound=new Sound()
            sndChannel=new SoundChannel()
       
           
            this.channelType=ct;
sndChannel.addEventListener(Event.SOUND_COMPLETE,soundCompleteHandler,true,0,false);

}

Channel play function


ActionScript Code:
public function playAudio() {
            this.sound=tracksArray[currentSound]
           
            this.sndChannel=sound.play();
        }
Channel handle function


ActionScript Code:
public function soundCompleteHandler(e:Event){
           
            trace("complete")
            }

Could somebody please help me figure out why my sound complete handler is not being called?

Thanks
dub

OnSoundComplete ?
Ok, I have a question about the onSoundComplete property. If I make a function like this:

Code:
bgSound.onSoundComplete = function() {
bgSound.start();
}
the music track or sound would repeat repeatedly. How is that different then bgSound.start(0, 999);

OnSoundComplete
I'm working on a text to speech project. Input goes to an array which calls a sound from the library, & onSoundComplete sends us to the next sound in the array. All is well. EXCEPT...the last sound in the array loops forever.

There's probably an easy answer to this, but I'm stumped as to how to let the thing know when it's done.



ActionScript Code:
var speak = new Sound(this);
speak.onSoundComplete = function() {
speak.attachSound(words.shift());
speak.start();
}

y = _root.answertext;
words = y.split(" ");

speak.onSoundComplete();
trace(soundArray);


Thanks in advance, guys!

Please Help; Next Btn And OnSoundComplete()
Hi,

Can someone help me form tearing out any more hair? The following code should work but it is not, it should play the next song:

this.sound_obj.onSoundComplete = function(){
(song_nr==songfile.length-1)?_global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};

I have it also attached to a Next button, as follows;

next_btn.onRelease = function(){
(song_nr == songfile.length+1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};

The XML code is as follows;

?xml version='1.0' encoding='utf-8'?>
<songs>
<song name="i-tuts" file="ituts_track.mp3" ><song />
<song name="test2" file="test2.mp3" ><song />
</songs>

Any help, will greatly reduce hair loss ;)

Boxing Boom

OnSoundComplete Help
I am trying to have a streamed mp3 loaded from xml, randomly play a new song on complete. I already have it play randomly onload. Here is what I have, and it doesnt work :


Code:
tickerLength = 52;
for (i=0; i<tickerLength; i++) {
leading += " ";
}
display.content = leading+"music...";
display.contentPos = 0;
display.delay = 5;
display.counter = 0;
one.enabled = false;
two.enabled = false;
three.enabled = false;
four.enabled = false;
five.enabled = false;
InitiateSong = function () {
var my = playlist.songs[playlist.currSong];
display.contentPos = 0;
playlist.soundObj.stop();
playlist.soundObj = new Sound();
playlist.soundObj.loadSound(my.url, true);
myMusicVolume = 100;
playlist.soundObj.setVolume(MyMusicVolume);
};
playlist = new XML();
playlist.ignoreWhite = true;
playlist.load("http://www.enervated.com/scribbles/audio/playlist.xml");
playlist.onLoad = function() {
this.soundObj = new Sound();
this.songs = new Array(this.childNodes.length);
for (i=0; i<this.songs.length; i++) {
var my = this.childNodes[i];
this.songs[i] = {};
this.songs[i].name = my.nodeName;
for (props in my.attributes) {
this.songs[i][props] = my.attributes[props];
}
}
playlist.onSoundComplete = function() {
choice = Math.round(Math.random()*4);
if (choice == 0) {
this.currSong = 0;
break;
} else if (choice == 1) {
this.currSong = 1;
break;
} else if (choice == 2) {
this.currSong = 2;
break;
} else if (choice == 3) {
this.currSong = 3;
break;
} else if (choice == 4) {
this.currSong = 4;
break;
}
InitiateSong();
}
choice = Math.round(Math.random()*4);
if (choice == 0) {
this.currSong = 0;
break;
} else if (choice == 1) {
this.currSong = 1;
break;
} else if (choice == 2) {
this.currSong = 2;
break;
} else if (choice == 3) {
this.currSong = 3;
break;
} else if (choice == 4) {
this.currSong = 4;
break;
}
InitiateSong();
one.enabled = true;
two.enabled = true;
three.enabled = true;
four.enabled = true;
five.enabled = true;
};
this.onEnterFrame = function() {
with (display) {
if (!(counter++%delay)) {
if (playlist.soundObj.position) {
var secs = Math.floor(playlist.soundObj.position/1000);
var mins = Math.floor(secs/60);
secs %= 60;
if (secs<10) {
secs = "0"+secs;
}
if (mins<10) {
mins = "0"+mins;
}
var my = playlist.songs[playlist.currSong];
content = leading+"playing "+my.title+" by "+my.artist+" from the album "+my.album+" - ["+mins+":"+secs+"]";
}
text = content.substr(contentPos, tickerLength);
if (++contentPos == content.length) {
contentPos = 0;
}
}
}
};
one.onRelease = function() {
playlist.currSong = 0;
InitiateSong();
};
two.onRelease = function() {
playlist.currSong = 1;
InitiateSong();
};
three.onRelease = function() {
playlist.currSong = 2;
InitiateSong();
};
four.onRelease = function() {
playlist.currSong = 3;
InitiateSong();
};
five.onRelease = function() {
playlist.currSong = 4;
InitiateSong();
};
off.onPress = function() {
playlist.soundObj.stop();
playlist.soundObj = new Sound();
display.content = "";
};
here is the final result: www.enervated.com

thanks in advance.

Please Help With OnSoundComplete
hello

I have a presentation which issplt into several different movies which are linked together by buttons, all im trying to do is add a sound which will play when the user moves over the button, and then another that will play when they click on the button; i got this to work once but it cut off the sound because it loaded a new movie, so i found the onSoundComplete command, which i've tried in a load of different ways but nothing works...
here's the code i've got at the moment:

on (rollOver)
{
mySound = new Sound(this);
mySound.attachSound("twisted1");
mySound.start(0, 0);
}
on (release)
{
mySound = new Sound(this);
mySound.attachSound("twisted2");
mySound.start(0, 0);
twisted2.onSoundComplete = function(loadMovie("history.swf", "this"));
}

and this is the error that im getting:

**Error** Scene=home, layer=links, frame=1:Line 12: ')' or ',' expected
twisted2.onSoundComplete = function(loadMovie("history.swf", "this"));

I've tried a few things but i just seem to get more errors...
I need to try and sort this by tomorrow (though I'll still want to know how to do this after tomorrow) so if anybody knows what I'm donig wrong then please please help me out.

thankyou
Tom

OnSoundComplete
is there a way to find out if a sound finished playing with load sound?
my sound is mps and is being loaded so it could be streaming

Code:
mysound = new Sound();
mysound.loadSound("Track 5.mp3", true);
onSoundComplete works with attachSound any suggestions?

OnSoundComplete Help
I am trying to have a streamed mp3 loaded from xml, randomly play a new song on complete. I already have it play randomly onload. Here is what I have, and it doesnt work :


Code:
tickerLength = 52;
for (i=0; i<tickerLength; i++) {
leading += " ";
}
display.content = leading+"music...";
display.contentPos = 0;
display.delay = 5;
display.counter = 0;
one.enabled = false;
two.enabled = false;
three.enabled = false;
four.enabled = false;
five.enabled = false;
InitiateSong = function () {
var my = playlist.songs[playlist.currSong];
display.contentPos = 0;
playlist.soundObj.stop();
playlist.soundObj = new Sound();
playlist.soundObj.loadSound(my.url, true);
myMusicVolume = 100;
playlist.soundObj.setVolume(MyMusicVolume);
};
playlist = new XML();
playlist.ignoreWhite = true;
playlist.load("http://www.enervated.com/scribbles/audio/playlist.xml");
playlist.onLoad = function() {
this.soundObj = new Sound();
this.songs = new Array(this.childNodes.length);
for (i=0; i<this.songs.length; i++) {
var my = this.childNodes[i];
this.songs[i] = {};
this.songs[i].name = my.nodeName;
for (props in my.attributes) {
this.songs[i][props] = my.attributes[props];
}
}
playlist.onSoundComplete = function() {
choice = Math.round(Math.random()*4);
if (choice == 0) {
this.currSong = 0;
break;
} else if (choice == 1) {
this.currSong = 1;
break;
} else if (choice == 2) {
this.currSong = 2;
break;
} else if (choice == 3) {
this.currSong = 3;
break;
} else if (choice == 4) {
this.currSong = 4;
break;
}
InitiateSong();
}
choice = Math.round(Math.random()*4);
if (choice == 0) {
this.currSong = 0;
break;
} else if (choice == 1) {
this.currSong = 1;
break;
} else if (choice == 2) {
this.currSong = 2;
break;
} else if (choice == 3) {
this.currSong = 3;
break;
} else if (choice == 4) {
this.currSong = 4;
break;
}
InitiateSong();
one.enabled = true;
two.enabled = true;
three.enabled = true;
four.enabled = true;
five.enabled = true;
};
this.onEnterFrame = function() {
with (display) {
if (!(counter++%delay)) {
if (playlist.soundObj.position) {
var secs = Math.floor(playlist.soundObj.position/1000);
var mins = Math.floor(secs/60);
secs %= 60;
if (secs<10) {
secs = "0"+secs;
}
if (mins<10) {
mins = "0"+mins;
}
var my = playlist.songs[playlist.currSong];
content = leading+"playing "+my.title+" by "+my.artist+" from the album "+my.album+" - ["+mins+":"+secs+"]";
}
text = content.substr(contentPos, tickerLength);
if (++contentPos == content.length) {
contentPos = 0;
}
}
}
};
one.onRelease = function() {
playlist.currSong = 0;
InitiateSong();
};
two.onRelease = function() {
playlist.currSong = 1;
InitiateSong();
};
three.onRelease = function() {
playlist.currSong = 2;
InitiateSong();
};
four.onRelease = function() {
playlist.currSong = 3;
InitiateSong();
};
five.onRelease = function() {
playlist.currSong = 4;
InitiateSong();
};
off.onPress = function() {
playlist.soundObj.stop();
playlist.soundObj = new Sound();
display.content = "";
};
here is the final result: www.enervated.com

thanks in advance.

OnSoundComplete
I have a container.swf that loads audio_1.swf onto a level. Audio_1.swf has five frames each with a narration (attachSound). I added an onSoundComplete action so that at end of the sound it will advance to the next frame and play the next sound. Works great for this standalone narration site and plays all 5 frames and 5 narrations one after the other.

Problem: I have 5 audio swfs (size issue) with having 3-5 frames of narration. After playing audio_1.swf, I cannot get container.swf to load audio_2.swf after 5th frame of audio_1.swf is completed with the last frame. The container.swf just sits there. I don’t know how to put an action in the container to check for the sound in a loaded movie to be complete. I know how to set variables but not through loaded movies in a level. Help!

OnSoundComplete
I am streaming sound like this

Code:
/*sound*/

// New sound
mySound = new Sound();

// Set buffer
_soundbuftime = 5;

// STATUS
_root.soundStatus.onEnterFrame = function() {

// Check size of mp3 ...
_root.myBytesTotal = _root.mySound.getBytesTotal();
_root.myBytesLoaded = _root.mySound.getBytesLoaded();

// Check percent loaded ...
_root.myPercentLoaded = parseInt((_root.myBytesLoaded / _root.myBytesTotal) * 100);
_root.eq_mc.eqText = _root.myPercentLoaded;
}

if (_root.myPercentLoaded >= 99){_root.eq_mc.gotoAndStop(4);}
and loading sound like this

Code:
_root.mySound.loadSound('music/idc.mp3',true);
I am trying to loop the sound when it is done but I am having no luck using onSoundComplete, is it possible to loop streaming music.

Thanks for the help

OnSoundComplete
Hi all,

I need to play a mc in my movie after the sound is complete. The thing is when the onSoundComplete function is being called it loses the reference to that sounds parent movie clip. All the examples online use root in the onSoundComplete to gain access to their MCs... I can and do not use _root. I have tried _parent and even attaching a reference to the root mc to that sound object, but I guess Flash Sound Object do not allow mc references to it, like buttons do.

Could anyone help me?

mcClip = mcStage; //MC on the timeline

soundIntro0.oRef = this; //Should be ref to the class
soundIntro0.onSoundComplete = function() {
trace(this.oRef); //Should be the above class, but it isnt
};

I also tried:
soundIntro0.oRef = mcClip;

Thanks
-Mike

OnSoundComplete
This may be a simple function, but I am not getting it... All I want to do is to have a sound play, then once finished, go to a URL. This is being used for a Flash intro. Any help is appreciated.

MrSlate

OnSoundComplete?
i cannot seem to get this function to work for an event sound (a non-streaming sound)

i am trying to be able to determine when an event sound is completed

the onSoundComplete function doesnt' seem to be detecting it properly.

this is my current code. it is a recursive function to play sequentially through sound objects which are referenced in an array. there are objects which contain Sound objects called sample, which have an instance name that coincide with what is stored in the array. can anyone see why the sounds that i am trying to play sequentially are all playing at the exact same time (or need any other info that can help you help me:)? (or, if anyone has a better, smarter way to accomplish this, feel free to release me from my headache)

THANKS!

(this is initially called as playX(0); )

function playX(pos)
{
if (pos < myArray.length)
{
eval(myArray[pos]).sample.start();
eval(myArray[pos-1]).sample.onSoundComplete = playX(++pos);
}
}

OnSoundComplete Emulation?
Is there some way to emulate the onSoundComplete function of Actionscript version 6 in Actionscript version 5?

In other words, how would one detect the end of a sound clip in Flash 5?

OnSoundComplete Problem
I'm a newbie to Flash MX (so perhaps this should be in newbies) - but can anyone tell me if the onSoundComplete event works with dynamically loaded mp3's?

I have four sound objects all with mp3's loaded into them, and have an animation that loops while any of the four is playing; but I can't get the animation to stop when the chosen sound finishes.

_root["mySound" + a].onSoundComplete = stopAC();
_root["mySound" + a].start();

I've put a trace in the stopAC() function (which also contains the script to stop the animation), but this is returned before the sound starts (in the order of the above code) rather than at the end as I'd expected. So could I have I put the onSoundComplete in the wrong place?

OnSoundComplete() Start();
Hello,

i have a movie that has a setinterval() which checks for onSoundComplete() to start() the song again only at an offest other than the start.


Code:
// earlier in the movie
Song1.start(0,1);

// later down
setInterval( function(){
// does some stuff
Song1.onSoundComplete = function(){
Song1.start(2100,99);
}
},300);


However I doesn't restart the song
1. Is the onSoundComplete invoked continually?(or do i have to keep invoking it to check?)
2.Do i have to place the start() in another frame norder to properly initiate it
3. will it start(21100,99) start at the offset and continue looping 99 times at the offset without having to do another onSoundComplete?

Kendall

OnSoundComplete Not Working
I hate reposters but I'm really stuck here so I'll just point you to the old thread.
http://www.flashkit.com/board/showth...97#post2673097

Some Help With OnSoundComplete Function
Hi,

I have voice-over that I want to play in my movie and when the voice over is done move to the next frame. Now Im trying to use a onSoundComplete function but, I must be doing something wrong cause it doesnt seem to work.


Code:
// Load voice
VSound = new Sound(Voice6_mc);
VSound.loadSound("Voices/Voice11.mp3", false);
// zero offset, repeat 10 times
VSound.start(0, 0);// use zero for now
///////////////////////////////////////////////////////////////////////////////////
VSound.onSoundComplete = function() {
_root.gotoAndPlay("v11");
};

OnSoundComplete() Redirect In URL?
hello, i'm new in flash, i'm trying to do this when the sound is finished playing. i want to redirect to another URL. is that posibble? i need your help plss.. thanks in advance.

OnSoundComplete From _level1
Hi All,
I have a main movie (_root) which loads an external swf file on level1.
The external swf file plays an external mp3 via a soundObject.
When the track ends I want my buttons to reset in the main movie.
I am trying to achieve this with the onSoundComplete command:

myMusic.onSoundComplete = function() {
_root.container.au_MC2.bplay1.gotoAndStop(5);
_root.container.au_MC2.bplay1.enabled = true;
_root.container.au_MC2.bplay1.useHandCursor = true;
_root.container.au_MC2.stop1._visible = false;

I've put this code in the external swf (which is loaded in level1)

Bit it isn't working!?
_level1 or _parent instead of _root isn't working either.

Can anyone help me out..please?

OnSoundComplete-problem
I know this has been discussed before and I have read many of the threads. But I can´t get this to work. I want to play several tracks after each.

The first function (track2) works fine but the next (track3 ) doesn´t work. Anyone knows what´s the problem?

-----

function track3(){
trace("track3");
var mySound3:Sound =new Sound();
mySound3.attachSound(g_id);
mySound3.start();
}
function track2(){
trace("track2");
var mySound2:Sound =new Sound();
mySound2.attachSound(d_id);
mySound2.onSoundComplete = track3;
mySound2.start();

}

var mySound:Sound = new Sound();
mySound.attachSound(s_id);
mySound.onSoundComplete = track2;

mySound.start();

Opposite Of OnSoundComplete?
Hi,

I am calling up an external MP3 in order cut file size in my clip, but I want to try and sync the animation up to the MP3 as much as possible. Since all browsers and connections will load and stream the MP3 at different times, is there ANY way to tell the clip to play only when the MP3 sound begins? I know the onSoundComplete command, but is there a way to create some kind of an onSoundStart command?

thanks,
jason

OnSoundComplete Function
i made an audio player and i cannot get the onSoundComplete function to work. it's really starting to get frustrating. has anyone else had this problem? and more importantly, has anyone else had this problem and fixed it?

thanks,
jason

FLV OnSoundComplete Equivalent?
I know there's a way to do this, but I'm feeling a bit under the weather and my fever could possibly be frying my brain, but I need to get this thing done by Monday, so I was hoping for a bit of help.

I know that with a dynamically loaded mp3 file you can tell Flash that when that mp3 is done, to move on and do something else. Is there a way to do that with an FLV as well? I've got about a 15-second long FLV that, when it reaches the end, should trigger several events to happen in other movieclips. I'm currently using the following scripts to load the movies into a Flash 6/7 instance of a MediaDisplay (a tad old school, but it works):


ActionScript Code:
vid.setMedia("test.flv", "FLV");
vid.play();

Is there a way to detect when I reach the end of the FLV and then trigger events elsewhere in my file? I'm pretty sure it has something to do with an event listener, but that's the extent of my knowledge on the subject.

Any help would be greatly appreciated!!

OnSoundComplete Question
I'm making an mp3 player that has multiple artists and multiple songs per artist. As of right now each song is in the first frame of individual SWFs which are loaded into level 99 of the main movie when the song name is clicked on. What I want to do (but don't know how) is put all the songs for an artist in one SWF (one song on each frame) and have it go to the next frame, thus playing the next song, after the current song completes.
I tried the code

Code:
onSoundComplete = gotoAndStop(nextFrame)
But as you probably guessed it did not work. How can I make this work?

Thanks,
Mike W.

Load New Mp3 OnSoundComplete
I am using the soundObject to load an mp3. When that mp3 is done playing I need to load a new sound. Can I set up an array of my sounds and load them from my array?

How would I do that?


ActionScript Code:
// Load voice
VSound = new Sound(Voice1_mc);
VSound.loadSound("Voices/v001.mp3", true);
VSound.setVolume(VSound.getVolume()+50);
// zero offset, repeat 10 times
VSound.start(0, 0);
//trace (VSound._name)
///////////////////////////////////////////////////////////////////////////////////
VSound.onSoundComplete = function() {
    //load new sound
};

Problem With OnSoundComplete
Hi

In the script of a frame I stopped the progress of the head with a stop(); command. Next I upload and I start a mp3 file.

I want the head go to the next frame when the sound end (I use onSoundComplete).

But I have a problem: the code don't work
onSoundComplete don't work


Code:
stopAllSounds();
suono_domanda = new Sound();
suono_domanda.loadSound("cartella_mp3/file.mp3", true);
suono_domanda.onSoundComplete = avanza_frame();
suono_domanda.start();

function avanza_frame(){
nextFrame();
}
What's wrong in my code? Help me!!

OnSoundComplete - Is A Mess
well not exactly... but sound.start() is:
sometimes when there is a lot going on flash does not start the soundobject!!! so if you are using onSoundComplete for something important, better think twice!

here's the workaround for everyone who is interested:

instead of:

Code:
snd.onSoundComplete = function(){
doNiftyFunction ()
};
snd.start();
we can do:

Code:
var len = snd.duration;
var inter = setInterval(function(){
doNiftyFunction ()
},len};
snd.start()
so even if flash lightheartedly decides to not play the sound, the function gets called....

Finding OnSoundComplete
I am wondering if there is a way to determine if a sound is still playing once you get to a certain frame in your movie.

What I am doing is loading and streaming a sound in one frame and letting it play while some other events take place. I stop the events at one point and wait for the sound clip to stop before continuing. This works if the sound is still playing when you get to that last frame. At that last frame I use the onSoundComplete function to go to the next frame. However, sometimes, though not every time, the sequence takes longer to play than the duration of the mp3. If that happens, I get to that last frame, and nothing happens, because the sound is no longer playing.

If there was a way to determine if that sound was still playing or not, I could use an if-then argument to continue playing the next sequence.

Maybe there's a different way to go about this. Somebody suggested forcing the sequence to match a certain frame rate, but I really don't want to go that route.

thanks.

Problem With OnSoundComplete
I've run into a problem with my audio streaming application. I tried to add a function to the event onSoundComplete, but nothing happens when the song finishes.

I have a Sound s.
s.onSoundComplete = playSong;

The function playSong works, because the other things that call playSong actually start the song, and if I click my "Next" button, it goes to the next song and plays. It just doesn't seem to fire when the song is over.

Thanks for your help.

Pesky 'onSoundComplete'...grr
hiya,
in my movie theres a button which loads an external .swf into my main movie like in this tutorial:
http://www.kirupa.com/developer/mx/soundbar.htm

i have the preloader set-up and on the third frame lies my mp3.
its in my library as song1 and in the linkage it is called song1 and is set to export for actionscript.

how can i get flash to tell me wether the mp3 is finished playing?
is it possible at all when the mp3 is on a frame?

the preloader jumps between frame 1 and 2 and checks wether bytes_loaded == bytes_total and then jumps to frame 3. and in the run scales a loader bar to 100%. (like in the tutorial above).

i want the movie to jump to another frame when the mp3 is through.
how should i proceed?

i fiddled about with onSoundComplete, but can't get it to work the way it should.

any ideas are greatly appreciated.
thanks,
dual

OnSoundComplete Problem
Hey guys,
I have a problem with flash player versions.
When I use onSoundComplete event it normally works at Flash Player 6 but it's broken at Flash Player 8. How can I call a function when my sound is finished?


Code:
s.onSoundComplete = playSong;
s.onSoundComplete = songName;
Thanks!!!

[flashMX] OnSoundComplete... Help
i have a sound file on the first frame of my movie. the sound starts playing right off. It is a 7sec story. I want the sound to finish before playing the next frame. This is the code i'm using.


sd = new Sound();
sd.attachSound("philSound");
sd.onSoundComplete = function() {
gotoAndPlay("wow");
}

It doesn't work. I have linked the sound file in the library and given it the linkage id of "philSound"
I'd appreciate any help with this.
thanks
maria

OnSoundComplete Emulation?
Is there some way to emulate the onSoundComplete function of Actionscript version 6 in Actionscript version 5?

In other words, how would one detect the end of a sound clip in Flash 5?

Copyright © 2005-08 www.BigResource.com, All rights reserved