Hi, this is probably a dumb question as always, and I did search for it this time, but couldn’t find what i was looking for
I took the tutorial on playing a sound file, but I want to know how to pause it, and stop it, eventually i want to do next and previous song buttons, but im not worried about those 2 for now.
This is the code I have
[AS]on (release) {
Finchsound = new Sound(this);
Finchsound.attachSound(“Finch3”);
Finchsound.start(0, 99);
}[/AS]
Finchsound.pause doesnt exist, so what would i use as an alternative, and also finchsound.stop didnt work
finally, if you click play multiple times it just plays the song again, so you have a ton of overlapping songs.
// create the variable in the timeline
status = "stopped";
// play button
on (release) {
if (status == "stopped") {
Finchsound = new Sound(this);
Finchsound.attachSound("Finch3");
Finchsound.start(0, 99);
status = "playing";
} else if (status == "paused") {
Finchsound.start(pausedat, 99);
status = "playing";
}
}
// pause button
on (release) {
if (status == "playing") {
pausedat = Finchsound.position;
status = "paused";
}
}
// stop button
on (release) {
if (status == "playing") {
Finchsound.stop();
status = "stopped";
}
}
i didn’t test the script but at least that’s the idea =)
hey kax, thanks a lot for the reply
however… i don’t think i did it right
i would attatch a .fla but its way too big cuz i used a full song and i dont wanna search for a small loop
the song wont start and the output window produces
[AS]Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement block must be terminated by ‘}’
on (release) {
Scene=Scene 1, Layer=Layer 1, Frame=1: Line 10: Syntax error.
}
[/AS]
not entirely sure what to do about that
all i have on the main timeline is - status = “stopped”;
do i need to do like an enterframe thing? if i do can u explain it because i am thoroughly confused
no problem on the delay, i appreciate that u did that for me at all
thats really cool of u, the good thing is that most of the code makes sense to me.
I’m gonna fool around with it to see if i can make it play again when u push the pause button for a second time but I’m not worried about that too much.
thank u so much!
I’m gonna fool around with it to see if i can make it play again when u push the pause button for a second time but I’m not worried about that too much.
i realized that as well!
WOW!!
I might finally be gettin the hang of this stuff…
ok so i still cant make my own stuff for crap
but im startin to understand how stuff works
awwwww
how sweet
come on tho, ive only been doin AS for about a month now
and im an incredibly slow learner due to the fact that im really stupid
so i think im doin alright