# Close loading video swf or flv

**URL:** <https://forum.kirupa.com/t/close-loading-video-swf-or-flv/314636>\
**Category:** flash\
**Created:** [October 5, 2010, 4:43am UTC](https://forum.kirupa.com/t/close-loading-video-swf-or-flv/314636 "2010-10-05T04:43:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelafoley](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@michaelafoley](https://forum.kirupa.com/u/michaelafoley)\
**Post date:** [October 5, 2010, 4:43am UTC](https://forum.kirupa.com/t/close-loading-video-swf-or-flv/314636/1 "2010-10-05T04:43:02Z")

</div>

So i have a site with three video players, one swf and two flv. My code does fine to unload each player and load the request but i have a problem if the user clicks on a second video before the first has loaded. It ends up playing both videos.  
So i put some code “contentLoaderInfo.addEventListener-open” to be able to close the loading video if needed. is this the best way?  
Note: this is only a small section of code, if more is needed let me know.

thumbLoader1.addEventListener(MouseEvent.CLICK, thumb1click);  
[COLOR=“Red”]test\_loader.contentLoaderInfo.addEventListener( Event.OPEN, thumb1click );  
loader.contentLoaderInfo.addEventListener( Event.OPEN, thumb1click );[/COLOR]

function thumb1click(event:MouseEvent):void {  
vid\_player = 1;  
playVideo();

```
    if(loader != null)		
{
loader.unloadAndStop();
    [COLOR="Red"]loader.close();[/COLOR]
}    
if(test_loader != null)		
{
test_loader.unloadAndStop();
    [COLOR="Red"]test_loader.close();[/COLOR]
}

```

}
