views:

420

answers:

1

Doing all this locally.

I have the code to load and play my .flv . What i need to have it do is play the entire .flv then load a .swf to replace the current one.

The code i am working from.

stage.displayState = StageDisplayState.FULL_SCREEN; 


var connection:NetConnection = new NetConnection();
var stream:NetStream;
var video:Video = new Video(1280,960);
var metaObj:Object = new Object();

function onMetaData(data:Object):void
{

}

connection.connect(null);
stream = new NetStream(connection);
stream.client = metaObj;
metaObj.onMetaData = onMetaData;
video.attachNetStream(stream);
addChild(video);
stream.play("intro.flv");
video.x = 0;
video.y = 0;
A: 

I have the same question, or a similar question. I want to load an external .swf after my .flv is finished playing. Here's my code.

stop();
// Setting up my netstream and playing my video

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
var vid:Video = new Video(888, 500);
//var req:URLRequest = new URLRequest("ponder20.swf");
//var loader:Loader = new Loader();

ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);


this.addChild(vid);
vid.attachNetStream(ns);
ns.play("resources/PonderLogo.09.22.f4v");

 // Handles Async errors by ignoring them

function asyncErrorHandler(event:AsyncErrorEvent):void {
    // Ignore
}

function netStatusHandler(event:NetStatusEvent):void {
    switch(event.info.code) {
      case "NetStream.Play.Stop":
         ns.close();
         vid.visible = false;

         break;
    }
}
I'm looking for a similar solution -- something that switches back and forth between flv and swf media. Does the above code work?
Brian