The Myriad Blog

Our Online Journal


Communication Between Two Flash Movies

| Posted by Peter Schultheiss on January 28th, 2009 at 12:12 pm

We recently created banner advertisments for the Arizona Department of Transportation that involved a hot air ballon flying from a top banner to a side banner on rollover.

ADOT Banner Example

In order to acheive something like this, you need to open a Local Connection between the two movies and send a function call and (optional) argument over that connection. The following snippet of code would go in the sending movie and could be attached to a button:

on (rollOver) {
    obj_sending_lc = new LocalConnection();
    obj_sending_lc.send('_ConnA', 'traceMyName', 'Peter');

In order for this to work, we will need to add code to the receiving movie making it ready to receive this information. The following snippet of code would go in the receiving movie:

obj_receiving_lc = new LocalConnection();
obj_receiving_lc.traceMyName = function(str_argument) {

In this example, my name would be traced to the output window of the second movie. Obviously, you would want to make changes to the function name and what it does, but this will get you going quickly.

Before you try this out on your own, be forewarned that you can't run the webpage in multiple tabs (which can happen during development) as only the first one will work.


There are no responses. Be the first to reply!

Leave a Reply

Security Code

Recent Projects
Our Services
Follow Us