PDA

View Full Version : Sound offset not working


Gunds Elf
05-13-2002, 05:16 PM
I've programmed a song player with Flash, following an example in the chapter 18 of the "Flash 5 Magic with actionscript" book. It has a selector from a list of songs, and four buttons: play, stop, rewind and pause.

Now, if you pause the sound you're supposed to start it on the very place that you paused it, using basically the mysound.start(secondoffset,loop) method. The issue is that it is not working, not even in the solved example in the book's cd Rom. I'm convinved that it is a bug, I've been searching for reports on a bug in this method on the internet, to no avail.

You can try for yourselves:
the pause button has this code

on (release) {
Musica.stop();
algo = getTimer();
TiempoMusicaPausa = (algo-TiempoMI)/1000;
Pausado = true;
Tocando = false;
}
//the play button:
on (release) {
if (tocando==false){
if (TiempoMusicaPausa == 0) {
Musica.start(0, 100);
} else {
Musica.start(TiempoMusicaPausa, 1);
}
TiempoMI = getTimer();
TiempoMusicaPausa = 0;
Pausado = false;
Tocando = true;
}
}

there´s also a frame script that initializates Pausado, Tocando and TiempoMusicaPausa, And that attaches the sound to the Musica Variable. The songs are 30 seconds samples, linkage is correctly directed, everything works fine except that when i pause the sound it always starts back in the 4 second, no matter where I pause.

Is anybody aware of this problem? is there a solution? a workaround?

Thanks

red penguin
05-13-2002, 05:30 PM
I got tocando as "playing" and pausado as "pausing"... What's algo ??
The code seems to read clean to me...Anyone else?

Gunds Elf
05-13-2002, 05:59 PM
Originally posted by red penguin
I got tocando as "playing" and pausado as "pausing"... What's algo ??
The code seems to read clean to me...Anyone else?

"algo" is a variable that i used in one of my many attempts to make the pause work, i put it there just to take the gettimer() out of the next line, wich calculates the diference between the moment of the pause and the tiem the song started playing.

I'm heading to the Macromedia site again to see is there is any maintenance patch. I'll post is i get the issue solved.

Gunds

red penguin
05-13-2002, 10:53 PM
I was thinking of the translation of "algo"...but I got it as "something"...right?

Keep us posted...

Gunds Elf
05-14-2002, 01:33 AM
Originally posted by red penguin
I was thinking of the translation of "algo"...but I got it as "something"...right?

Yeah, "algo" is "something" in spanish. Only four letters, so I use it a lot instead of "foo", wich is what an english prommager would use =)

I spend a lot of time today in the forums of Macromedia. Got some useful code which apparently does the same thing that my code does... but... no cigar yet. The new code is veryu similar in approach, but the button that is supposed to restart the song from the pause does not work.

I did a small test, tried to activate one of my songs with the following code in a frame action:

music=new sound("music1");
music.start(15,1);

Now, this is supposed to start the song in the 15th second BUT it doesn´t, it starts the sound around the 3rd or 4th second. The looping parameter does work, just the secondoffset parameter doesn't

Has anyone tested my code, or the mysound.start(offset, loop) method?

I've found a post in other forum of actionscript.org with the same issue, but no replies yet. It was posted a year ago, though.

Happy coding

Gunds Elf

Gunds Elf
05-14-2002, 01:58 AM
Originally posted by Gunds Elf

I did a small test, tried to activate one of my songs with the following code in a frame action:

music=new sound("music1");
music.start(15,1);

OOOPS. The test was, actually

music=new sound();
music.attachsound("music1");
music.start(15,1);

Gunds Elf

red penguin
05-15-2002, 12:13 AM
It offsets for me....