# Preloader in a video player class

**URL:** https://forum.kirupa.com/t/preloader-in-a-video-player-class/293245
**Category:** Uncategorized
**Created:** [July 25, 2009, 8:07pm UTC](https://forum.kirupa.com/t/preloader-in-a-video-player-class/293245 "2009-07-25T20:07:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![haroldc](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@haroldc](https://forum.kirupa.com/u/haroldc)
#### Post date: [July 25, 2009, 8:07pm UTC](https://forum.kirupa.com/t/preloader-in-a-video-player-class/293245/1 "2009-07-25T20:07:31Z")

</div>

Hi,

I want to add this function to my videoplayer class :

```auto
private function onProgress(e:ProgressEvent):void{
   
   var percent:Number = e.bytesLoaded / e.bytesTotal;
   fill_mc.scaleX = percent;
   text_txt.text = "Loading..."+(Math.round(percent*100))+"%";
   
}

private function onComplete(e:Event):void{
   
   TweenLite.to(myPreloader_mc., 3, {alpha:0});
}

```

In order to have a preloader in case the video takes time to dl.

How do I rely it to the the netsream, what do I have to add , and where exactly?

Thanks for your help

Harold.
