Hi,
Try this one....
stop();
import flash.media.Sound;
import flash.media.SoundChannel;
var my_sound:Sound = new Sound();
*init();*
*
*
*function init():void {*
*
*
*if(my_sound!=undefined){*
*delete my_sound;*
*my_sound = new Sound();*
*}*
*my_sound.load(new URLRequest("ChildrensSong.mp3"));
var my_channel:SoundChannel = new SoundChannel();
btnOn.addEventListener(MouseEvent.CLICK,fnOn);
btnOff.addEventListener(MouseEvent.CLICK,fnOff);
my_channel=my_sound.play();
btnOn.alpha=.3;
btnOff.alpha=1;
music.gotoAndPlay(1);*
*
*
*}*
***
*function fnOn(event:MouseEvent)
{
my_channel=my_sound.play();
btnOn.alpha=.3;
btnOff.alpha=1;
music.gotoAndPlay(1);
}
function fnOff(event:MouseEvent)
{
my_channel.stop();
music.gotoAndStop(13);
btnOff.alpha=.3;
btnOn.alpha=1.0;
}
On 2 February 2010 10:06, krishna2004 <[email protected]> wrote:
> Dear Flex and Flash Developers,
> I have done one website in flash cs4 in that Music On/Off buttons
> are there for entire website to play and stop the music. But the
> problem is that when i go and come back from contact page to home page
> then music will repeat once again its overlapping with the previous
> playing music.. i am not getting where i am doing wrong. please any
> one can help me. its very urgent.
> Thanks in Advance.
>
> stop();
> import flash.media.Sound;
> import flash.media.SoundChannel;
> var my_sound:Sound = new Sound();
> my_sound.load(new URLRequest("ChildrensSong.mp3"));
>
> var my_channel:SoundChannel = new SoundChannel();
> btnOn.addEventListener(MouseEvent.CLICK,fnOn);
> btnOff.addEventListener(MouseEvent.CLICK,fnOff);
> my_channel=my_sound.play();
> btnOn.alpha=.3;
> btnOff.alpha=1;
> music.gotoAndPlay(1);
> function fnOn(event:MouseEvent)
> {
> my_channel=my_sound.play();
> btnOn.alpha=.3;
> btnOff.alpha=1;
> music.gotoAndPlay(1);
> }
> function fnOff(event:MouseEvent)
> {
> my_channel.stop();
> music.gotoAndStop(13);
> btnOff.alpha=.3;
> btnOn.alpha=1.0;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>
--
With best regards
@rindam
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.