# Working With Video in AS3

**URL:** <https://forum.kirupa.com/t/working-with-video-in-as3/273453>\
**Category:** flash\
**Created:** [October 15, 2008, 5:05pm UTC](https://forum.kirupa.com/t/working-with-video-in-as3/273453 "2008-10-15T17:05:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThaJock](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@ThaJock](https://forum.kirupa.com/u/ThaJock)\
**Post date:** [October 15, 2008, 5:05pm UTC](https://forum.kirupa.com/t/working-with-video-in-as3/273453/1 "2008-10-15T17:05:24Z")

</div>

I have the following code to play a video from the main stage:

var nc:NetConnection = new NetConnection();  
nc.connect(null);

var ns:NetStream = new NetStream(nc);  
ns.client = this;  
ns.play("/Volumes/MY BOOK/ Part 1.flv");

function onMetaData(info:Object):void {  
trace(“MetaData Recieved”);  
}

var vid:Video = new Video();  
vid.attachNetStream(ns);  
addChild(vid);  
vid.x=48;  
vid.y=52;  
vid.width=500;  
vid.height=337

function onPlayClick(evt:MouseEvent):void {  
ns.resume();  
}

function onPauseClick(evt:MouseEvent):void {  
ns.pause();

function onBackClick(evt:MouseEvent):void {  
ns.pause();  
ns.seek(0);  
}

playBtn.addEventListener (MouseEvent.CLICK ,onPlayClick);  
pauseBtn.addEventListener(MouseEvent.CLICK,onPauseClick);  
backBtn.addEventListener(MouseEvent.CLICK, onBackClick);

I have 5 flv videos that I want the user to choose from. I have 5 buttons on the main stage. What is the best way to program these buttons onRelease to play another video and for the controls (play,pause,stop) to control the video selected.

Any help would be greatly appreciated
