Video Memory Problem

Hello all,

I am having a flash video problem. I am trying to make my own video player that will also play images and swfs. Right now I am only playing video (.h264 and On2 formats). My video player will always crash in about 4-12 hours. I have tested playing my playlist using the FLVPlayback component, and that doesn’t crash leading me to believe there is something in my code that blows everything up.

here is my code…

private function
playPlaylist ( increment : Number = 0 ) : void
{
curFile += increment ;
if ( curFile >= Files.length )
{
curFile = 0 ;
}

		var t : Object = Files[curFile] ;
		
		switch ( t.type )
		{
			case "img":
				if ( t.image != null )
				{
					resizeImage ( t.image );
					addChild ( t.image ) ;
					if ( timer != null )
					{
						timer = new Timer ( (( c_imageHold - c_timeForTween ) * 1000),1);
						timer.addEventListener ( TimerEvent.TIMER , imageComplete,false,0,true) ;
					}
					timer.start();
				}
				else if ( t.url != null )
				{
					
				}
				break ;
			case "swf" :
				if ( t.swf != null )
				{
					resizeImage ( t.swf) ;
					addChild ( t.swf ) ;
					t.swf.addEventListener ( WandEvent.SWF_END,handleSwf,false,0,true ) ;
					t.swf.addEventListener ( WandEvent.SWF_START,handleSwf ,false,0,true) ;
					t.swf.gotoAndPlay(1);
				}
				else if ( t.url != null )
				{
					
				}
				break;
			
			case "flv":
			case "vid":
				if ( netCon == null)
				{
					setUpVideoPlayer ( );
				}
				netStream.play(wand.filePrefix + t.url );
				addChild(videoPlayer);
				break;
			default :
				trace( "-FILE NOT FOUND!-" ) ;
				break ;
		}
	}
	
	private function
	setUpVideoPlayer (  ) :void
	{
		netCon = new NetConnection ( );
		netCon.connect(null);
		netStream = new NetStream ( netCon ) ;
		netStream.addEventListener ( NetStatusEvent.NET_STATUS, VideoComplete ,false,0,true) ;
		netStream.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler,false,0,true);
		metaClient  =  new Object ( ) ;
		metaClient.onMetaData = metaData ;
		metaClient.onXMPData = xmpData ;
		netStream.client = metaClient ;
		videoPlayer = new Video ( vidSize.x,vidSize.y ) ;
		videoPlayer.attachNetStream(netStream ) ;
	}
	
	private function
	metaData ( e : Object ) : void
	{
		
	}
	
	private function
	xmpData ( e : Object) : void
	{
		
	}
	
	private function
	VideoComplete ( stats : NetStatusEvent ) : void
	{
		switch ( stats.info.code )
		{	
			case "NetStream.buffer.Empty":
			case "NetStream.Play.StreamNotFound" :
			case "NetStream.Play.Failed":
			case "NetStream.Play.InsufficientBW":
			case "NetStream.Connect.Failed" :
			case "NetStream.Failed" :
				break ;
					
			case "NetStream.Play.Stop" :
				if ( Files.length > 1 )
				{
					trace ( "REMOVING FLV");
					removeChild(videoPlayer);

					playPlaylist ( 1 )  ;
				}
				else
				{
					netStream.seek ( 0 ) ;
					netStream.play(wand.filePrefix + Files[curFile].url );
				}
				dispatchEvent ( new Event ( "DONE" , false ,false )) ;
				break ;
		}
		
	}
	
	private function
	ioErrorHandler ( e :IOErrorEvent ) : void
	{
		//Do nothing.
		removeChild(videoPlayer);
		playPlaylist ( 1 )  ;
	}