Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash button still works after enabled = false

Status
Not open for further replies.

DaSe

Programmer
Feb 14, 2008
149
0
0
GB
To whom it may concern... ;)

Hi...I just try to implement a very easy flash player ( just stop / play buttons ). And when you press play - it plays. The problems is that you can still press 'play' button while the song is playing and it still loads the song making it overlaid with sound.. I tried to imply enabled = false, the button greys out - and still works ! it's AS3..
Code:
var soundRequest:URLRequest = new URLRequest("[URL unfurl="true"]http://localhost/tests/sound/s1.mp3");[/URL]


var sound_:Sound = new Sound();
var soundControl:SoundChannel = new SoundChannel();
sound_.load(soundRequest);

playButton_.addEventListener(MouseEvent.MOUSE_DOWN, playSound);


stopButton_.addEventListener(MouseEvent.MOUSE_DOWN, stopSound);




function playSound(event:MouseEvent):void {
soundControl = sound_.play();
playButton_.enabled = false;
gotoAndStop(2);
}

====Frame 2===
   
 function stopSound(event:MouseEvent):void
    {

		
		soundControl.stop();
  
	  
	   
	   }

Thank you.
 
Ok, I've found the solution finally by removing EventListener in frame 1 and adding it in frame 2 again. Of course right after I've posted it - typical..



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top