00:00
00:00
Newgrounds Background Image Theme

Rico-Daima68 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!

How do I make a button that stops a certain audio track? (Flash 8, AS2.0))

385 Views | 5 Replies
New Topic Respond to this Topic

Hi! I'm making a Flash game using Macromedia Flash 8 on ActionScript 2.0, and so far, it's going great! But I have an issue i'm looking to fix:

So, The Intro is kind of long (11 seconds), not unbearable, but a little bit annoying during play testing and replays, so, I programmed a skip button! But there is a problem, The game's intro and the game itself, use one song, but it is divided into 2 tracks: The Intro Track, and The Game Track, This was to make sure that when the intro is skipped, the game directly starts playing the other, more extreme, if ya will, part of the song, think of it when you skip the intro of the Legacy edition of one of the Riddle School games (The 2.0 version on GameJolt), where when you skip the intro, the song skips to the beat drop, when the game has to start, the problem is that when the intro is skipped, the intro track continues playing over the game track, and the only code in AS2 I have found online that could be found useful not only mutes the intro track, but also the game track, so, if someone could help me out on this, I would highly appreciate it.


(I originally posted it on the "Where is / How to / Help!" forum, but I'm reposting it here since this is more related to programming rather than general help)


where are the naked pics tom!!!!!

BBS Signature

Sound - Flash CS5 ActionScript 2.0 Language Reference (open-flash.github.io)


Pass the ID of the intro sound to Sound.stop(). You might have to play the intro track dynamically if that doesn't work.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

At 3/16/24 05:25 PM, Gimmick wrote:Sound - Flash CS5 ActionScript 2.0 Language Reference (open-flash.github.io)

Pass the ID of the intro sound to Sound.stop(). You might have to play the intro track dynamically if that doesn't work.


Shows this error and disables the functionality of the skip button, "intro" is the identifier of the track (Check second image)

iu_1176126_17955409.png

iu_1176127_17955409.png


where are the naked pics tom!!!!!

BBS Signature

At 3/16/24 05:36 PM, TuxerTuxar wrote:
At 3/16/24 05:25 PM, Gimmick wrote:Sound - Flash CS5 ActionScript 2.0 Language Reference (open-flash.github.io)

Pass the ID of the intro sound to Sound.stop(). You might have to play the intro track dynamically if that doesn't work.

Shows this error and disables the functionality of the skip button, "intro" is the identifier of the track (Check second image)


I'm not fully sure what that error means in AS2 but if I had to guess then it probably means that you can't do Sound.stop(), you'll have to create a Sound object and then call soundObj.stop().


But for that to work best you might just have to create the intro sound dynamically using the Sound object.


As an aside, are you using Sound.stop(intro) or Sound.stop("intro")? I think it's supposed to be the latter.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

At 3/17/24 12:23 AM, Gimmick wrote:
At 3/16/24 05:36 PM, TuxerTuxar wrote:
At 3/16/24 05:25 PM, Gimmick wrote:Sound - Flash CS5 ActionScript 2.0 Language Reference (open-flash.github.io)

Pass the ID of the intro sound to Sound.stop(). You might have to play the intro track dynamically if that doesn't work.

Shows this error and disables the functionality of the skip button, "intro" is the identifier of the track (Check second image)

I'm not fully sure what that error means in AS2 but if I had to guess then it probably means that you can't do Sound.stop(), you'll have to create a Sound object and then call soundObj.stop().

But for that to work best you might just have to create the intro sound dynamically using the Sound object.

As an aside, are you using Sound.stop(intro) or Sound.stop("intro")? I think it's supposed to be the latter.


Sorry, but i'm new to Flash Programming, how do I make a sound object?


where are the naked pics tom!!!!!

BBS Signature

At 3/17/24 12:23 AM, Gimmick wrote:
At 3/16/24 05:36 PM, TuxerTuxar wrote:
At 3/16/24 05:25 PM, Gimmick wrote:Sound - Flash CS5 ActionScript 2.0 Language Reference (open-flash.github.io)

Pass the ID of the intro sound to Sound.stop(). You might have to play the intro track dynamically if that doesn't work.

Shows this error and disables the functionality of the skip button, "intro" is the identifier of the track (Check second image)

I'm not fully sure what that error means in AS2 but if I had to guess then it probably means that you can't do Sound.stop(), you'll have to create a Sound object and then call soundObj.stop().

But for that to work best you might just have to create the intro sound dynamically using the Sound object.

As an aside, are you using Sound.stop(intro) or Sound.stop("intro")? I think it's supposed to be the latter.


by the way, I tried using "Sound.stop("intro")", and it told me this:

iu_1176422_17955409.png


where are the naked pics tom!!!!!

BBS Signature