troubleshooting Question

Help with Action Script 3 Adobe Flash CS5.5

Avatar of tunapo
tunapo asked on
Adobe FlashScripting LanguagesMultimedia Programming
9 Comments1 Solution561 ViewsLast Modified:
How do i add auto play to this as3 script?
and also please show me or help me rewrite this code to have a stop button instead of having the play button does both job i would like to have a play and a stop button
and another problem i am facing is that every time the play button is clicked it loads a new sound and start playing, so now i have two streams of the same song playing at the same time (please help)
play_btn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);

var fl_SC:SoundChannel;

//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay:Boolean = true;

function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
	if(fl_ToPlay)
	{
		var s:Sound = new Sound(new URLRequest("http://74.92.128.50:8001/stream"));
		fl_SC = s.play();
	}
	else
	{
		fl_SC.stop();
	}
	fl_ToPlay = !fl_ToPlay;
}
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros