I can play the .flv movie after compilation through FlashDevelop but its not working if I move the whole directory into another PC or another Directory in the same PC. Your help will be much appreciated...Thanks
package
{
import flash.display.Sprite;
import flash.net.N开发者_StackOverflow社区etConnection;
import flash.net.NetStream;
import flash.media.Video;
public class Main extends Sprite {
private var nc:NetConnection;
private var ns:NetStream;
private var vid:Video;
private var client:Object;
public function Main () {
// Initialize net stream
nc = new NetConnection();
nc.connect (null); // Not using a media server.
ns = new NetStream(nc);
// Add video to stage
vid = new Video(320,240);
addChild (vid);
//vid.x = ( stage.stageWidth / 2) - ( vid.width / 2 );
//vid.y = ( stage.stageHeight / 2) - ( vid.height / 2 );
// Changed since when deployed the
// above set the video player nearly off the screen
// Since I am lazy, I am just going to 0 them
// out for now. Apparently, I have a lot more
// to learn.
vid.x = 0;
vid.y = 0;
// Add callback method for listening on
// NetStream meta data
client = new Object();
ns.client = client;
client.onMetaData = nsMetaDataCallback;
// Play video
vid.attachNetStream ( ns );
ns.play ( 'dancinggirl_1.flv' );
}
//MetaData
private function nsMetaDataCallback (mdata:Object):void {
trace (mdata.duration);
}
}
}
You have to specify the path where your flv is located and asure the flv is located in this relative path to your swf.
ns.play ( 'path/to/dancinggirl_1.flv' );
If you embed the swf into a HTML page. The path has to be relative to the HTML, not the swf file.
精彩评论