To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 06-28-2007, 03:50 PM   #1
BRock790
Junior Member
 
Join Date: Jun 2007
Posts: 24
[F8] making sound pause or wait

how can I add a pause to a sound with out having to make the whole movie pause? I was trying to add a dumb while loop but that caused the whole movieto pause
BRock790 is offline   Reply With Quote
Old 06-28-2007, 04:21 PM   #2
providence0630
Senior Member
 
Join Date: Mar 2007
Posts: 279
you can create 2 buttons 1 for stop and 1 for play

where my 2 buttons are named musicoff = off button and musicon = on button

stop music
Code:
musicoff_btn.onRelease = function(){
	_root.my_music.stop();
}
start music
Code:
musicon_btn.onRelease = function(){
	_root.my_music.start();
providence0630 is offline   Reply With Quote
Old 06-28-2007, 04:26 PM   #3
BRock790
Junior Member
 
Join Date: Jun 2007
Posts: 24
is there anyway to do it with out using buttons...for example if i have two audio files that are supposed to play back to back but i just want to add a pause inbetween them
BRock790 is offline   Reply With Quote
Old 06-28-2007, 04:38 PM   #4
AfternoonDelite
Senior Member
 
Join Date: Jan 2006
Location: USA
Posts: 383
So, you want a delay?

A quick and dirty way to do a delay:

PHP Code:
var time:Number = 6;
var
count:Number = 0;

function
delay(time:Number, count:Number) {
   if(
count == time) {
      return
true;
   }
}

function
onEnterFrame() {
   if(
delay(time, count++)) {
      
//call function to play next song
      
delete onEnterFrame;
   }
}
AfternoonDelite is offline   Reply With Quote
Old 06-28-2007, 04:43 PM   #5
BRock790
Junior Member
 
Join Date: Jun 2007
Posts: 24
wont that delay all the animation going on aswell though?
BRock790 is offline   Reply With Quote
Old 06-28-2007, 04:47 PM   #6
AfternoonDelite
Senior Member
 
Join Date: Jan 2006
Location: USA
Posts: 383
Why would it?

All you're doing is waiting until you play the next song..

You could even use intervals.

PHP Code:
var delayInterval:Number = setInterval(delay, 1000 / 30);
var
count:Number = 0;
var
time:Number = 10;

function
delay() {
   if(
count == time) {
      
playSong(next);
      
clearInterval(delayInterval);
   } else {
      
count++;
   }
}
AfternoonDelite is offline   Reply With Quote
Old 06-28-2007, 05:17 PM   #7
gorlummeeguvnor
Senior Member
 
Join Date: Nov 2004
Posts: 873
this will repeat 2 songs with a 3 second gap between them.
it assumes you have 2 songs in your library named s1 and s2.
3000 is milliseconds - so set it to what you need


_root.createEmptyMovieClip("sound1",1);
_root.createEmptyMovieClip("sound2",2);
s1 = new Sound(sound1);
s2 = new Sound(sound2);
s1.attachSound("s1");
s2.attachSound("s2");
s1.start();
s1.onSoundComplete = function() {
delay(s2);
}
s2.onSoundComplete = function() {
delay(s1);
}
function delay(sound) {
sound.del = setInterval(setDelay,3000,sound);
}
function setDelay(sound) {
sound.start();
clearInterval(sound.del);
}
gorlummeeguvnor is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:21 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.