# Local Connection

**URL:** <https://forum.kirupa.com/t/local-connection/315804>\
**Category:** flash\
**Created:** [November 4, 2010, 3:45pm UTC](https://forum.kirupa.com/t/local-connection/315804 "2010-11-04T15:45:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [November 4, 2010, 3:45pm UTC](https://forum.kirupa.com/t/local-connection/315804/1 "2010-11-04T15:45:05Z")

</div>

I am trying to load a different swf movie into my many swf movies on a single html page.

I have a controller swf … which has an array of paths for these movies which are jumbled up upon the load of the html page.

I have (say 6) other swfs (reciever.swf) loading into the page, which all have a unique ID through as flashVar, denoting them as 0, 1, 2 etc…

Simply enough each reciever looks at the controller’s array, and inputs its ID to get its path to load a random, yet unique SWF.

I am having problems with getting this to work with local connection though …

Here is my code for the controller and the reciever … Can anyone help out why it’s not working past the first reciever…  
controller.swf

```auto
var ranAry:Array = new Array("zero","one","two","three","four");
function randomise() 
{
    r = function() 
	{
        return random(2)*2-1;
    };
    ranAry.sort(r);
}
randomise();
var to:String;
var from:String;
var num:Number = 0;
var IN:LocalConnection = new LocalConnection();
var OUT:LocalConnection = new LocalConnection();
to = "movie"+num;
from = "from"+num;
OUT.send(to, "recieve_ary", ranAry);
IN.LoadNext = function(textRecieved:String) 
{
	error_txt.text = num;
	num++;
	from = "from"+num;
	to = "movie"+num;
	OUT.send(to, "recieve_ary", ranAry);
	IN.connect(from);
}
IN.connect(from);

```

And here’s the code for the reciever.swf::

```auto
var IN:LocalConnection = new LocalConnection();
var OUT:LocalConnection = new LocalConnection();
var flashVars:Number = ID;
var from:String = "from"+ID;
var to:String = "movie"+ID
IN.recieve_ary = function(ranAry:Array) 
{
	varTxt.text = ranAry[ID];
	OUT.send(from, "LoadNext", "OK");
};
IN.connect(to);

```

That SHOULD work right!!!? I just cant get it to ☹

I have had to implement a setInterval to get it working properly (the dirty way) …
