00:00
00:00
Newgrounds Background Image Theme

DezTenShot67 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss: Pausing Sound Object Sounds

1,386 Views | 9 Replies
New Topic Respond to this Topic

Foss: Pausing Sound Object Sounds 2005-11-23 13:39:06


Well, I just wanted to share this little script I wrote. I wont explain it very much, but it should be fairly easy to understand.

First import a sound. Then set it's linkage name to something, and export in first frame. Then just write this on the main timeline:

var soundS:Number = 0;
var soundC:Number = 0;
var whatever:Sound = new sound(this);
whatever.attachSound("sound");

Then make two buttons, one labled Start, one Continue, and one Pause.

On start button:

on(release){
whatever.stop();
whatever.start(0, 1);
soundS = getTimer();
}

On pause button:

on(release){
whatever.stop();
soundC = getTimer()-soundS;
}

In continue button:

on(release){
whatever.start(soundC/1000, 1);
}

Well, thats it I guess.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:42:16


At 11/23/05 01:39 PM, Claxor wrote: var whatever:Sound = new sound(this);

Typo, change to:

var whatever:Sound = new Sound(this);


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:51:05


Yay, nice.
If anyone wants more with timers you can see here :P
Nice Foss though.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:51:18


Could be useful for those who cannot figure it out by themselves.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:53:10


At 11/23/05 01:51 PM, Rantzien wrote: Could be useful for those who cannot figure it out by themselves.

....no shit?

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:56:23


At 11/23/05 01:51 PM, Rantzien wrote: Could be useful for those who cannot figure it out by themselves.

lol


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:56:26


At 11/23/05 01:53 PM, -fwe- wrote:
At 11/23/05 01:51 PM, Rantzien wrote: Could be useful for those who cannot figure it out by themselves.
....no shit?

Ya shit.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 13:56:41


At 11/23/05 01:42 PM, Claxor wrote:
At 11/23/05 01:39 PM, Claxor wrote: var whatever:Sound = new sound(this);
Typo, change to:

var whatever:Sound = new Sound(this);

Always check your AS before posting. I'd also suggest posting a sample or something.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 14:13:41


At 11/23/05 01:51 PM, Rantzien wrote: Could be useful for those who cannot figure it out by themselves.

Yeah, that was what I thought. About the sample, I cannot do that right now, as I'm not at my computer.


BBS Signature

Response to Foss: Pausing Sound Object Sounds 2005-11-23 14:56:49


A whole FOSS for this? =P Well, I'll add it but I don't like it.


Sup, bitches :)

BBS Signature