# A button in one SWF gotoandplay in another SWF on the same HTML page

**URL:** <https://forum.kirupa.com/t/a-button-in-one-swf-gotoandplay-in-another-swf-on-the-same-html-page/326097>\
**Category:** flash\
**Created:** [November 22, 2011, 8:12pm UTC](https://forum.kirupa.com/t/a-button-in-one-swf-gotoandplay-in-another-swf-on-the-same-html-page/326097 "2011-11-22T20:12:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dominic\_Smith](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dominic\_Smith](https://forum.kirupa.com/u/Dominic_Smith)\
**Post date:** [November 22, 2011, 8:12pm UTC](https://forum.kirupa.com/t/a-button-in-one-swf-gotoandplay-in-another-swf-on-the-same-html-page/326097/1 "2011-11-22T20:12:40Z")

</div>

[COLOR=#000000][FONT=verdana]Ooooohkay, i’ve been digging through the internet to try and find a solution to this… Basically i have two SWFs on my page, one of them has a button which i want to affect the SWF to the right of the page. So when you click the button, it simply goes to and plays from a frame in the second swf! Seems like it should be quite simple but none of the Local Connection tuts i’ve found make it very simple for my uneducated useless brain  
[COLOR=#222222][FONT=Helvetica]  
If anyone can help we need to get this thing up asap would be much appreciated.[/FONT][/COLOR]  
[/FONT][/COLOR]

Sooo… This is the code we have in the sending SWF:

> stop();  
> var sending\_lc:LocalConnection;  
> sending\_lc = new LocalConnection();

function send\_it(evt:MouseEvent):void {  
sending\_lc.send(“\_myConnection”, “buttonClick”);  
}

\_DomsTitty.addEventListener(MouseEvent.CLICK, send\_it);

and this is what is in the receiving file

> var receiverLC:LocalConnection;  
> receiverLC = new LocalConnection();  
> receiverLC.client=this;  
> receiverLC.connect(“\_myConnection”);  
> function buttonClick(event:MouseEvent):void {  
> gotoAndPlay(63)  
> }

Basically, you click on the button on the left and it starts the movie at frame 63 on the right!

See EG here: [http://eviltwin.tv/test/test.html](http://eviltwin.tv/test/test.html)

You’re supposed to click the little girl on the left which will drop the anvil on the little girl to the right - you can see that animation in action here: [http://eviltwin.tv/wp/](http://eviltwin.tv/wp/)

THANKS SO MUCH! Really need to get this up asap!

Let me know if anyone needs the FLAs!
