troubleshooting Question

Loading bar for FLVplayback

Avatar of jonevenkm
jonevenkm asked on
Adobe FlashScripting Languages
4 Comments1 Solution321 ViewsLast Modified:
Hi! I'm working on a "TV" in Flash where I use several videos running at the same time, so the videos tend to be lagging in the beginning. I think I would need a loading bar to show the user when the TV is ready to be turned on. I would really appreciate it if someone would take a look at it and see how it can be done. I can submit the fla-file as well if that is necessary. Thank you!

The swf-file can be found here:
http://hoguslg.uib.no/infomevi171/v11/jmy044/semesteroppgave/liveVideo-proto.swf

 
import flash.events.MouseEvent;

channel1.stop();
channel2.stop();
channel3.stop();
channel4.stop();
channel5.stop();
channel6.stop();

turnOnTv.addEventListener(MouseEvent.CLICK, turnOnTvFunction)
turnOffTv.addEventListener(MouseEvent.CLICK, turnOffTvFunction)
channelBtn1.addEventListener(MouseEvent.CLICK, channel1Function)
channelBtn2.addEventListener(MouseEvent.CLICK, channel2Function)
channelBtn3.addEventListener(MouseEvent.CLICK, channel3Function)
channelBtn4.addEventListener(MouseEvent.CLICK, channel4Function)
channelBtn5.addEventListener(MouseEvent.CLICK, channel5Function)
channelBtn6.addEventListener(MouseEvent.CLICK, channel6Function)

//Turn TV on
function turnOnTvFunction(e:MouseEvent):void
{
	channel1.play();
	channel2.play();
	channel3.play();
	channel4.play();
	channel5.play();
	channel6.play();
	tvOff.visible = false;
	channel1.visible = true;
	channel2.visible = false;
	channel3.visible = false;
	channel4.visible = false;
	channel5.visible = false;
	channel6.visible = false;
	channel1.volume = 1;
	channel2.volume = 0;
	channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Turn TV off
function turnOffTvFunction(e:MouseEvent):void
{
	tvOff.visible = true;
    channel1.volume = 0;
    channel2.volume = 0;
    channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Channel 1
function channel1Function(e:MouseEvent):void
{
	channel1.visible = true;
	channel2.visible = false;
	channel3.visible = false;
	channel4.visible = false;
	channel5.visible = false;
	channel6.visible = false;
	channel1.volume = 1;
	channel2.volume = 0;
	channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Channel 2
function channel2Function(e:MouseEvent):void
{
	channel1.visible = false;
	channel2.visible = true;
	channel3.visible = false;
	channel4.visible = false;
	channel5.visible = false;
	channel6.visible = false;
	channel1.volume = 0;
	channel2.volume = 1;
	channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Channel 3
function channel3Function(e:MouseEvent):void
{
	channel1.visible = false;
	channel2.visible = false;
	channel3.visible = true;
	channel4.visible = false;
	channel5.visible = false;
    channel6.visible = false;
	channel1.volume = 0;
	channel2.volume = 0;
	channel3.volume = 1;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Channel 4
function channel4Function(e:MouseEvent):void
{
	channel1.visible = false;
	channel2.visible = false;
	channel3.visible = false;
	channel4.visible = true;
	channel5.visible = false;
	channel6.visible = false;
	channel1.volume = 0;
	channel2.volume = 0;
	channel3.volume = 0;
	channel4.volume = 1;
	channel5.volume = 0;
	channel6.volume = 0;
}

//Channel 5
function channel5Function(e:MouseEvent):void
{
	channel1.visible = false;
	channel2.visible = false;
	channel3.visible = false;
	channel4.visible = false;
	channel5.visible = true;
	channel6.visible = false;
	channel1.volume = 0;
	channel2.volume = 0;
	channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 1;
	channel6.volume = 0;
}

//Channel 6
function channel6Function(e:MouseEvent):void
{
	channel1.visible = false;
	channel2.visible = false;
	channel3.visible = false;
	channel4.visible = false;
	channel5.visible = false;
	channel6.visible = true;
	channel1.volume = 0;
	channel2.volume = 0;
	channel3.volume = 0;
	channel4.volume = 0;
	channel5.volume = 0;
	channel6.volume = 1;
}


import fl.video.*; 

//Channel1 loop
channel1.addEventListener(VideoEvent.COMPLETE, completeHandler);
function completeHandler(event:VideoEvent):void 
{
channel1.play();
}

//Channel2 loop
channel2.addEventListener(VideoEvent.COMPLETE, completeHandler2);
function completeHandler2(event:VideoEvent):void 
{
channel2.play();
}

//Channel3 loop
channel3.addEventListener(VideoEvent.COMPLETE, completeHandler3);
function completeHandler3(event:VideoEvent):void 
{
channel3.play();
}

//Channel4 loop
channel4.addEventListener(VideoEvent.COMPLETE, completeHandler4);
function completeHandler4(event:VideoEvent):void 
{
channel4.play();
}

//Channel5 loop
channel5.addEventListener(VideoEvent.COMPLETE, completeHandler5);
function completeHandler5(event:VideoEvent):void 
{
channel5.play();
}

//Channel6 loop
channel6.addEventListener(VideoEvent.COMPLETE, completeHandler6);
function completeHandler6(event:VideoEvent):void 
{
channel6.play();
}
ASKER CERTIFIED SOLUTION
deepanjandas

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 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 4 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