# Function to load video

**URL:** <https://forum.kirupa.com/t/function-to-load-video/258760>\
**Category:** Uncategorized\
**Created:** [April 27, 2008, 11:48pm UTC](https://forum.kirupa.com/t/function-to-load-video/258760 "2008-04-27T23:48:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mycaptainkite](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@mycaptainkite](https://forum.kirupa.com/u/mycaptainkite)\
**Post date:** [April 27, 2008, 11:48pm UTC](https://forum.kirupa.com/t/function-to-load-video/258760/1 "2008-04-27T23:48:18Z")

</div>

I’m trying to make a function to load videos at the end of a tween using Tweener but its just not working…

Here’s the code the set up the video objects:

```auto

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
videoInterfaceMC.videoMC.attachVideo(stream_ns);

```

Then the function to load the video:

```auto

// Function that loads video into videoMC
function loadVideo(filename:String) {
    stream_ns.play(filename);
}

```

The code to called the function:

```auto

Tweener.addTween(videoInterfaceMC, {_y:780, time:2.5, delay:12, transition:'easeoutcirc', onComplete:loadVideo('video/video.flv')});

```

I even tried putting the first set of code inside the function… but that doesn’t work either. It doesn’t give any errors… just doesn’t load the video. It works fine when I just use stream\_ns.play(‘video/video.flv’)… but I want to be able to load different videos.
