Avatar of jonevenkm
jonevenkm
 asked on

Loading bar for FLVplayback

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();
}

Open in new window

Adobe FlashScripting Languages

Avatar of undefined
Last Comment
CyanBlue

8/22/2022 - Mon
deepanjandas

You can develop individual buffering as showing the loading for individual videos.
There is no way you can track all the video loading at once. You can do a hack by doing a preload but that will be time consuming as all the videos will need to get preloaded before starting.

Warm Regards
Deepanjan Das
jonevenkm

ASKER
Thank you very much! My actionscript-skills are very bad, so i have to ask. How do I create those individual bufferings?
ASKER CERTIFIED SOLUTION
deepanjandas

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
CyanBlue

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23