javascript-flash communication

Can anyone tell me if there are any other alternatives for javascript to communicate with a flash file other than using the setVariable() method as a flag to call flash methods? Also, does anyone know of how I could cache my processing so that javascript will wait for flash and vice versa?

LVL 39
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how about localConnection..

or SharedObjects...
blue-genieAuthor Commented:
Hi Rex. it's my colleague asking this question.
he's a java programmer, what he's basically wants to know is, can you use javascript to call a method in flash, and if yes, how would you do this.

here is my way

see this how to properly embed the movie :

i think it is not possible to call a method directly in flash. therefore i use a setter function to transport the parameters and a getter function to fetch the result. (obj.addProperty(n,s,g))
here are my files:

<script language="javascript">
var cf=function(fn){
      var r= new Array();
      for(var i=0; i< arguments.length-1; i++){
      document.xy.SetVariable(fn, r.join(";"));
 // i pass the arguments converted to a string
      return document.xy.GetVariable(fn);
<a href="javascript:alert(cf('obj.multiply',45,3));">click</a>

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Yep, there is. Use SetVariable to pass arguments, and TCallLabel to invoke the script (pseudo function call):
blue-genieAuthor Commented:

Glad you're around, I told my colleague if any one can answer this it would be you.

What he's trying to do is, using Javascript, calls a method in Flash, its not parsing anything to the Flash, the Javascript must then wait for a return value from the flash method, before it proceeds with anything else.

Can this be done, can you help with an example?
Many thanks,

Hi, blue.. :)

Well, I think that you could use to look for changes on a variable in flash, but not the same by javascript side. I think you should go with simple function calls:

- javascript set a variable in flash, then call the function (SetVariable + TCallLabel)
- flash, when done, calls back javascript (getURL("javascript:function(parameters)");)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blue-genieAuthor Commented:
Ok, thanks neg.

We're gonna work on it for a while and I'll get back to you.

It makes sense.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.