# CS3 AS2 loaded swf button function as main swf button local connection

**URL:** <https://forum.kirupa.com/t/cs3-as2-loaded-swf-button-function-as-main-swf-button-local-connection/294633>\
**Category:** flash\
**Created:** [August 17, 2009, 7:55pm UTC](https://forum.kirupa.com/t/cs3-as2-loaded-swf-button-function-as-main-swf-button-local-connection/294633 "2009-08-17T19:55:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![loosecanon](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@loosecanon](https://forum.kirupa.com/u/loosecanon)\
**Post date:** [August 17, 2009, 7:55pm UTC](https://forum.kirupa.com/t/cs3-as2-loaded-swf-button-function-as-main-swf-button-local-connection/294633/1 "2009-08-17T19:55:49Z")

</div>

Trying to get a button in a loaded swf to perform the same function as button in main swf using a local connection. Loaded swf is home page content with nav buttons for a scrolling web page. Tried to copy and paste some code I found but it is not working.

original working code for button in main swf:

btnProducts\_mc.onRelease = function () {  
this.enabled=false;  
var result\_tween:Object = new Tween(scroll\_mc,"\_x",Regular.easeOut,scroll\_mc.\_x,-1560,1.5,true);  
result\_tween.onMotionFinished=function(){  
btnProducts\_mc.enabled=true;  
}

local connection code for button in loaded swf:

on (release) {  
salesLC = new LocalConnection();  
salesLC.send(“sales\_lc”, “goToProducts”, btnProducts);  
}

local connection code in main swf:

salesLC = new LocalConnection();  
salesLC.goToProducts = function(btnProducts) {  
this.enabled=false;  
var result\_tween:Object = new Tween(scroll\_mc,"\_x",Regular.easeOut,scroll\_mc.\_x,-1560,1.5,true);  
result\_tween.onMotionFinished=function(){  
result\_tween\_mc.enabled=true;  
};  
listeningLC.connect(“sales\_lc”);  
}

Any enlightenment would be greatly appreciated.
