function setPath(str:String) {
// Create a NetConnection object
var my_nc:NetConnection = new NetConnection();
// Create a local streaming connection
my_nc.connect(null);
// Create a NetStream object and define an onStatus() function
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
// Set the buffer time
my_ns.setBufferTime(5);
// Begin playing the FLV file
my_ns.play(str);
}
alternatively if you're playing local flv files you can set the contentPath of player with str instead of doing the netStream.
then you just call the function
setPath("http://myserver/video.flv");
onClipEvent (load) {video.flv.contentPath = str;
}
function setPath(str:String) {
video.flv.contentPath = str;
}