How to start/stop sound with one click on same MC

(help please?)

Page 1 of 1

0 Replies - 1023 Views - Last Post: 13 February 2009 - 12:06 PM

#1 joyalexa250   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-February 09

How to start/stop sound with one click on same MC

Posted 13 February 2009 - 12:06 PM

Hello All,

I need help please... I've searched all over the internet and my flash books, and can't seem to figure this out, but I KNOW it can be done. I'm thinking it is a logic (if/then) equation.

Basically, I have a movie clip (_head_MC) that when it is clicked it loads and plays an SWF in a defined position, AND it loads and plays a 15 second MP3.

I would like for the user to be able to click the same movie clip (_head_MC) and have both the SWF and the MP3 stop playing.

Is this possible???

My current code is as follows. (though I don't know how to alter it to accomplish what I want) please help!!!

var soundReq:URLRequest = new URLRequest("om.mp3");
var sound:Sound = new Sound();
var soundControl:SoundChannel = new SoundChannel();
sound.load(soundReq);

sound.addEventListener(Event.COMPLETE, onComplete);


function onComplete(event:Event):void
{
	head_MC.addEventListener(MouseEvent.CLICK, playSound);
	
}

function playSound(event:MouseEvent):void
{
	soundControl = sound.play();
}


//play animation

var head_req:URLRequest = new URLRequest("mandala.swf");

var myLoader:Loader = new Loader();
mc_loader.addChild(myLoader);


head_MC.addEventListener(MouseEvent.CLICK, handle_head);

function handle_head (evt:MouseEvent) {
	myLoader.load(head_req);
	
	
}



head_MC.buttonMode = true



Is This A Good Question/Topic? 0
  • +

Page 1 of 1