| | | erikcute |  |
| Posted: Wed Aug 06, 2008 10:18 am Post subject: Communication between 2 SWF Animations |  |
| |  | |
Hi! I'm trying to control the animation between 2 SWF files contained on a same webpage.
SWF-1 should stop its animation and play SWF-2 upon reaching a certain frame. Then SWF-2 should also stop its animation and should play SWF-1 upon reaching a certain frame.
I managed to establish the connection from SWF-1 to SWF-2 and its working up to this point.
I really need help coz I'm running out of ideas :sad;
This is the action on the first frame of SWF-1:
mysender_2 = new LocalConnection( ); myReceiver_1 = new LocalConnection( ); myReceiver_1. doAction_ 1 = function (doThat_1) { if (doThat_1 == 1) { play (); } else if (doThat_1 == 2) { stop (); } else if (doThat_1 == 3) { gotoAndPlay( 232); } };
Then this is the action that will trigger SWF-2 to play myReceiver_1. connect(" myConnection_ 1"); onEnterFrame = function () { _root.mySender_ 2.send("myConnec tion_2", "doAction_2" , 1); stop(); };
At this point the connection is successful...however, I used the same code for SWF-2 to trigger SWF-1 but I don't know why it doesn't work.
This is the action on the first frame of SWF-2:
mySender_1 = new LocalConnection( ); myReceiver_2 = new LocalConnection( ); myReceiver_2. doAction_ 2 = function (doThat_2) { if (doThat_2 == 1) { play (); } else if (doThat_2 == 2) { stop (); } };
Then this is the action that should trigger SWF-1 to play from a certain frame myReceiver_2. connect(" myConnection_ 2"); onEnterFrame = function () { _root.mySender_ 1.send("myConnec tion_1", "doAction_1" , 3); stop(); }; |
|