ActionScript 3 Working with Video Load and play external video file


reference : NetConnection , NetStream , Video

related topics : Working with Sound

Basic example of playing an external video file (FLV, MP4, F4V). Code will also play M4A audio files.

var nc:NetConnection = new NetConnection();

var ns:NetStream = new NetStream(nc);

var myVideo:Video = new Video();


Notice the code used a nc.connect.null? This is because, in this case, there is no need to create a two-way peer to peer connection (eg: as expected in a video chat app) since we are playing a stored file.

By setting a nc.connect.null it is required to provide a link to a file that is either on a web server or one that is local (same location/folder) to the running SWF.

  • For a web file use :"");
  • For a local file use :"somefile.mp4");