Hi all,

I've set up my first localConnection file and while I got it to work one way - I need that swf to return the favor with I would imagine the same code with a few changes. Basically I have two swf videos on the same page. One automatically begins playing. If you click on the other video it pauses the main video and works correctly. Now if you unpause the main video - it should pause the other one and vice versa.

Can someone take a look at my code and tell me if I'm close and help me out a little? Lot of code so bare with me.

file 1:
Code:
stop();

//----------------LocalConnection----------------------
sending2.send("myConnection2","messageHandler2", 0);
receiving = new LocalConnection();
receiving.messageHandler = function(msgType) {
	switch (msgType) {

		case 0 :
			//pause video
			_root.thumb_checkPlaying();
			break;
		case 1 :
			//play video
			break;
	}
};
receiving.connect("myConnection");
//-------------------------------------------------------
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(3);
ns.onStatus = function(info) {
	if (info.code == "NetStream.Buffer.Full") {
		bufferClip._visible = false;
	} else if (info.code == "NetStream.Buffer.Empty") {
		bufferClip._visible = true;
	} else if (info.code == "NetStream.Play.Start") {
		posterFrame_mc._visible = false;
	} else if (info.code == "NetStream.Play.Stop") {
		ns.seek(0);
		ns.pause();
		mainIsPlaying = false;
		playButton._visible = true;
		pauseButton._visible = false;
		posterFrame_mc._visible = true;
		bufferClip._visible = false;
		playArrow._visible = true;

	}
};

playArrow._visible = false;

//---------ATTACHING NETSTREAM-------------
video.attachVideo(ns);

//---------PLAYING EXTERNAL FLV------------
ns.play("salesvideo.flv");//          


//------------------CONTROLS--------------------------------
playButton._visible = false;
rewindButton.onRelease = function() {
	ns.seek(0);
};
pauseButton.onRelease = function() {
	ns.pause();
	playButton._visible = true;
	pauseButton._visible = false;
	mainIsPlaying = false;
	posterFrame_mc._visible = false;
	playArrow._visible = false;
	sending2.send("myConnection2","messageHandler2", 0);
};
playButton.onRelease = function() {
	ns.pause();
	playButton._visible = false;
	pauseButton._visible = true;
	mainIsPlaying = true;
	posterFrame_mc._visible = false;
	playArrow._visible = false;
	sending2.send("myConnection2","messageHandler2", 0);
};
playArrow.onRelease = function() {
	ns.pause();
	playButton._visible = false;
	pauseButton._visible = true;
	mainIsPlaying = true;
	posterFrame_mc._visible = false;
	playArrow._visible = false;
};
playArrow.onRollOver = function() {
	this.gotoAndPlay("Over");
	playButton.gotoAndStop("Over");
};
playArrow.onRollOut = function() {
	this.gotoAndPlay("Out");
	playButton.gotoAndStop("Out");
};

//----------------------------------CHECK IF VIDEO IS PLAYING--------------------------------
mainIsPlaying = true;

function main_checkPlaying() {
	if (mainIsPlaying == true) {
		//code to pause
		pauseButton.onRelease();// edited
	} else {
		//code to unpause
		playButton.onRelease();// edited
	}
}

function thumb_checkPlaying() {
	if (mainIsPlaying == true) {
		pauseButton.onRelease();// edited
	}
}
File 2:
Code:
stop();

closeBtnRed.onRelease = function(){
	gotoAndStop("Start");
	ns.close();
}
//----------------LocalConnection----------------------

receiving2 = new LocalConnection();
receiving2.messageHandler2 = function(msgType2) {
	switch (msgType2) {

		case 0 :
			//pause video
			_root.thumb_checkPlaying();
			break;
		case 1 :
			//play video
			break;
	}
};
receiving.connect("myConnection2");
//-------------------------------------------------------
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(3);
ns.onStatus = function(info) {
	if (info.code == "NetStream.Buffer.Full") {
		bufferClip._visible = false;
	} else if (info.code == "NetStream.Buffer.Empty") {
		bufferClip._visible = true;
	} else if (info.code == "NetStream.Play.Start") {
		posterFrame_mc._visible = false;
	} else if (info.code == "NetStream.Play.Stop") {
		ns.seek(0);
		ns.pause();
		mainIsPlaying = false;
		playButton._visible = true;
		pauseButton._visible = false;
		posterFrame_mc._visible = true;
		bufferClip._visible = false;
		playArrow._visible = true;

	}
};

playArrow._visible = false;

//--------------------------------------ATTACH NETSTREAM---------------------
video.attachVideo(ns);
//-----------------------------------NETSTREAM FILE-------------------------------
ns.play("Clip12-SD-sml.flv");

//----------------------------------CHECK IF VIDEO IS PLAYING--------------------------------
mainIsPlaying = true;

function main_checkPlaying() {
	if (mainIsPlaying == true) {
		//code to pause
		pauseButton.onRelease();// edited
	} else {
		//code to unpause
		playButton.onRelease();// edited
	}
}

function thumb_checkPlaying() {
	if (mainIsPlaying == true) {
		pauseButton.onRelease();// edited
	}
}
Any advice?