Passing values between two or more SWF with Actionscript 3

Posted in Flash by Flash CS3 and Flash CS4 tutorials on the 09-08-2009

The LocalConnection class of Actionscript 3 and Flash CS3-CS4, permits us to share values between two or more SWF that reside in the same HTML page.

This class is used by those who develop games but not only.
It can be very useful, that’s why I created a simple example to show how to use it.

I created two FLA files (sender.fla and receiver.fla) with the respective Document Class (Sender.as and Receiver.as).
In the file sender.fla I added two buttons (play and stop).
In the file Sender.as I created the logics to connect the LocalConnection in Flash and send the data to another SWF which at that moment is connected to the same LocalConnection and who resides in the same HTML page that resides sender.fla.
In the file Receiver.as I created a LocalConnection connection to sender.fla and I added a little movie that will be controlled by two buttons of sender.fla.

Let’s see the code.

Read more…

Tags: , ,

Related posts


Read full article

  1. Responses to “Passing values between two or more SWF with Actionscript 3”

Post a Comment

captcha