Skip to main content
Participant
April 22, 2009
Answered

How can I pass variables between domains?

  • April 22, 2009
  • 1 reply
  • 907 views

So I have an SWF8 file as a player on one domain (unsecure).  It loads and plays an SWF8 from another (secure) domain.  So far so good.  Trouble is, I need the player to send variables to the files it's playing so that links in that SWF will, well, link.  I also need the player to receive some movie control commands in return.  There must be a rule or two I'm violating, because while the file plays, anything that depends on a variable is just dead.

A note:  Both files started out as SWF6.  I understand I can only do what I'm trying to with SWF8, so I went through the code and fixed the case sensitive issues and did the conversion.

Can I do this?  If so, how?  Is scripting for variables from another domain different somehow?

Thanks in advance.

This topic has been closed for replies.
Correct answer kglad

Yes and yes.  The SWF from my host will play within the SWF player from their host.  So you could go to their site and it would seem you're watching an animation on their site, but most of it is really coming from mine.  Both SWF's open at the same time, on the same page, on the same computer.  Does that help clarify what I'm attempting?


so you can use localconnection() to communicate between the two.

if the swfs need to both send and receive data, use 2 localconnection instances in each swf.

1 reply

kglad
Community Expert
Community Expert
April 22, 2009

if both are open at the same time in the same host, use localconnection.  if both are open at different times in the same host, use the sharedobject.

dboyz0616Author
Participant
April 22, 2009

Sorry I wasn't clear about that.  The two files are on different hosts.  Can it be done with that being the case?

kglad
Community Expert
Community Expert
April 22, 2009

if the swfs are opened on different host computers you cannot pass data directly from one to the other.  you can pass data via server-side scripting (like php).