# Local Connection using external as-file?

**URL:** <https://forum.kirupa.com/t/local-connection-using-external-as-file/178354>\
**Category:** flash\
**Created:** [February 9, 2006, 6:37pm UTC](https://forum.kirupa.com/t/local-connection-using-external-as-file/178354 "2006-02-09T18:37:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![silenoz](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@silenoz](https://forum.kirupa.com/u/silenoz)\
**Post date:** [February 9, 2006, 6:37pm UTC](https://forum.kirupa.com/t/local-connection-using-external-as-file/178354/1 "2006-02-09T18:37:35Z")

</div>

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.

```auto

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.
