Local Connection using external as-file?

Hi there everyone!

First some background. I am using Flash 8 (screen based project) and now a problem has occured that can be related to the LocalConnection class. All code in this project by the way is in external AS-files.

I have two swf-files that communicate with each other and everything works just fine. But, ONLY if I put the actionscript related to the LocalConnection class on the first frame of the timeline of the two swf-files.
Now the problem is that I have to move the code from the timeline to the constructor in GamePage.as(it needs to run when the GamePage loads/starts). By doing this the code/syntax needs to be adjusted for the class file and that is why I need your help.

This is the code suited for the timeline that I need help with, to modify it to work/run in the constructor of the as-file.


var isOpen:Boolean;
var gameOpenSend_lc:LocalConnection = new LocalConnection();
gameOpenSend_lc.send("lc2_name", "gameIsOpen", isOpen);

var receiving_lc:LocalConnection = new LocalConnection();

//this function works on the timeline, but of course not in the constructor
//of an as-file. How do I change it?
receiving_lc.userGameID = function(tableObj:Object, userObj:Object) {
	_global.tableObj = tableObj;
	_global.userObj = userObj;
}

receiving_lc.connect("lc_name");

I hope that you understand my problem but if you don’t, please just tell me and I will try to further explain myself.

I would be greatful for any help in the right direction.