playing video messes up when done.
kamckng Jun 2, 2009 6:18 AMHello everyone,
I'm trying to play an opening animation in my flash movie before I move on to the interactive stuff. I have tried to do this in two ways.
The first way:
My movie is two frames. In the first frame on the timeline, I have a movieclip that has a video object in it on the stage. I add code to play a video in it like so and then go to frame 2 where there is a movieclip linked to an external class with all of the rest of my code in it:
//////////////////////////////////////
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
movieHolder.video.attachVideo(ns);
movieHolder.video._width = 800;
movieHolder.video._height = 600;
ns.onStatus = function(e:Object):Void {
if(e.code == "NetStream.Play.Stop") {
trace("video done playing");
_root.gotoAndStop(2);
}
}
ns.play("cut_scenes/opening_animation.flv");
////////////////////////////////////////////////////////
This plays the video just fine. The problem is once the video is done, the trace statement works, but then I get some REALLY weird error. I get a popup box that says "There is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR1"... what the heck does that mean???
My external class does work because when on it's own in a single frame it works just fine. This video thing is just something I wanted to add on to it. The second way I do it, is in the actual external class itself. The movieclip associated with the class is on frame one. Then inside the class I have this:
////////////////////////////////////////
public function Main() {
playOpeningAnimation();
}
private function playOpeningAnimation():Void {
//i have tried both _root.attachMovie and this.attachMovie. this attaches the movie with the video object inside of it.
//both the movieHolder and the movieHolder.video trace out fine, so it does exist.
var movieHolder:MovieClip = _root.attachMovie("movieHolder", "movieHolder", getNextHighestDepth());
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
movieHolder.video.attachVideo(ns);
ns.onStatus = function(e:Object):Void {
trace(e.code);
if(e.code == "NetStream.Play.Stop") {
startGame();
}
}
ns.play("cut_scenes/opening_animation.flv");
}
///////////////////////////////////////
This one here doesnt even play at all, and i get no status codes at all in the onStatus event listener.


