Why wont this work?

I’m tryingf to make a player which have an add in the beginning of movie and when movie stoppes the add shows again… I got it working in the beginning, but somehow the movie just “freezes” at the end not showing the add… What am I doing wrong?

// THE FLV HOLDER //
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var player:NetStream = new NetStream(connection_nc);
my_video.attachVideo(player);

// ****************** START: Init events ****************** //

var listenerEventStopped:Object = new Object();
listenerEventStopped.stopped = function(eventObject:Object):Void
{
	logoOn();
}
player.addEventListener("stopped", listenerEventStopped);

// Playing event
var listenerEventPlaying:Object = new Object();

listenerEventPlaying.playing = function(eventObject:Object):Void
{
	clearInterval(intervalId);
	
	player.play("flv/test.flv");
}

player.addEventListener("playing", listenerEventPlaying);

// ****************** END: Init events ****************** //

// ****************** Logo init ******************

logoholder.loadMovie("images/logo.jpg");
init();


// ***************************************************************************
// ***************************** START: Functions ***************************
// ***************************************************************************

function init():Void
{
	intervalId = setInterval(this, "logoOff", 3000);
}

//////////////////////////////// After play /////////////////////////////

function logoOn():Void
{
	player.stop();
}

////////////////////////////// Play Movie ///////////////////////

function logoOff():Void
{
	clearInterval(intervalId);
	
	player.play("flv/test.flv");
}

// ***************************** STOP ****************************
Array()

Plaese help and thanks in advance…

Remove all the object and listeners you’ve set up and instead use this:

player.onStatus = function(infoObject:Object)
{
        if(infoObject.code=="NetStream.Play.Stop")
	{
		//do stuff at end of video here
		//
		//
	}
};