[AS2] Communication between 2 SWF Files

Hi! I’m trying to control the animation between 2 SWF files contained on a same webpage.

SWF-1 should pause its animation upon reaching a certain frame and play SWF-2. Then SWF-2 should also pause its animation upon reaching a certain frame and should play SWF-1 from where it paused.

I managed to establish the connection from SWF-1 to SWF-2 and its working up to this point.

This is the action on the first frame of SWF-1:

//code going to Movie 2
mysender_2 = new LocalConnection();
 
//code coming from Movie 1 
myReceiver_1 = new LocalConnection();
myReceiver_1.connect("myConnection_1"); 
myReceiver_1.doAction_1 = function(doThat_1) {
if (doThat_1 == 1) {
        play();
    } else if (doThat_1 == 2) {
        stop();
    } else if (doThat_1 == 3) {
        gotoAndPlay(210);
}
};

Then this is the action that triggers SWF-2 to play

myReceiver_1.connect("myConnection_1");
onEnterFrame = function ()
{
    mysender_2.send("myConnection_2", "doAction_2", 1);
};

At this point the connection is successful…however, I used the same code structure for SWF-2 to trigger SWF-1 but I don’t know why it won’t work.

This is the action on the first frame of SWF-2:

stop();
//code coming from Movie 2 
myReceiver_2 = new LocalConnection();
myReceiver_2.connect("myConnection_2"); 
myReceiver_2.doAction_2 = function(doThat_2) {
if (doThat_2 == 1) {
        play();
    } else if (doThat_2 == 2) {
        stop();
}
};
 
//code going to Movie 1
mysender_1 = new LocalConnection();

Then this is the action that should trigger SWF-1 to play from where it paused

myReceiver_2.connect("myConnection_2");
onEnterFrame = function ()
{
_root.mysender_1.send("myConnection_1", "doAction_1", 3);
};

I really need help coz I’m running out of ideas :crying: