terraform
10-29-2009, 06:32 PM
**Sound SUPER newbie** + AS3 novice (I know some but am no coder)
I like what the script below does
but I need it to be extended in 2 ways and I can not figure how.
this is what I would like this code to do...
1. play (ideally stream) sound automatically on entering the site.
(right now the play button must be invoked, and it takes a little time to load.)
2. loop that same sound source
3. ideally instead of stopping the sound I would prefer a pause.
so more simply
sound plays on entering site
and I have ONE button (well 2 but changing visibilities)
that control only pause and resume
any thoughts suggestions pointers?
I have looked around quite a bit
but can never find what I am looking for
it would appear that everyones sound issues are so unique that no one
has the exact issue that I do (well I am sure many do but I can't find the thread. :confused:)
thanks in advance AS.org rocks (great community!)
oh and here is a link (http://www.markofman.com/dev/audio/audioBtn.html) to what I have as of now
var loadSnd:URLRequest = new URLRequest("ax Mr .l..mp3");
var thisSnd:Sound = new Sound();
thisSnd.load(loadSnd);
play_btn.addEventListener(MouseEvent.CLICK,playF);
stop_btn.addEventListener(MouseEvent.CLICK,stopF);
var sndTrans:SoundChannel = new SoundChannel();
var st:SoundTransform = new SoundTransform();
stop_btn.visible = false;
function playF(e:MouseEvent):void
{
SoundMixer.stopAll();
st.volume = .9;
sndTrans.soundTransform = st;
sndTrans = thisSnd.play();
play_btn.visible = false;
stop_btn.visible = true;
}
function stopF(e:MouseEvent):void
{
sndTrans.stop();
play_btn.visible = true;
stop_btn.visible = false;
}
I like what the script below does
but I need it to be extended in 2 ways and I can not figure how.
this is what I would like this code to do...
1. play (ideally stream) sound automatically on entering the site.
(right now the play button must be invoked, and it takes a little time to load.)
2. loop that same sound source
3. ideally instead of stopping the sound I would prefer a pause.
so more simply
sound plays on entering site
and I have ONE button (well 2 but changing visibilities)
that control only pause and resume
any thoughts suggestions pointers?
I have looked around quite a bit
but can never find what I am looking for
it would appear that everyones sound issues are so unique that no one
has the exact issue that I do (well I am sure many do but I can't find the thread. :confused:)
thanks in advance AS.org rocks (great community!)
oh and here is a link (http://www.markofman.com/dev/audio/audioBtn.html) to what I have as of now
var loadSnd:URLRequest = new URLRequest("ax Mr .l..mp3");
var thisSnd:Sound = new Sound();
thisSnd.load(loadSnd);
play_btn.addEventListener(MouseEvent.CLICK,playF);
stop_btn.addEventListener(MouseEvent.CLICK,stopF);
var sndTrans:SoundChannel = new SoundChannel();
var st:SoundTransform = new SoundTransform();
stop_btn.visible = false;
function playF(e:MouseEvent):void
{
SoundMixer.stopAll();
st.volume = .9;
sndTrans.soundTransform = st;
sndTrans = thisSnd.play();
play_btn.visible = false;
stop_btn.visible = true;
}
function stopF(e:MouseEvent):void
{
sndTrans.stop();
play_btn.visible = true;
stop_btn.visible = false;
}