We help IT Professionals succeed at work.

Loading bar for FLVplayback

317 Views
Last Modified: 2013-11-11
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

Comment
Watch Question

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

Author

Commented:
Thank you very much! My actionscript-skills are very bad, so i have to ask. How do I create those individual bufferings?
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.