PDA

View Full Version : Sending message/calling Flash from C++ or JavaScript



SimeonPanev
May 28th, 2002, 09:18 AM
Hi everybody,


In our application we have an embedded Flash control (in a HTML file in our Browser control) that shows some games.
I looking for some way to call / notify this Flash control from C++ or JavaScript when some events are happening outside of it in order to display something / set it's internal values.

Any ideas how (if possible) this could be acheived?
I think there is an option to call JavaScript from C++ and then JavaScript call Flash, but that's looks a bit tricky to me.
I am new to Flash and wondered is there is a way to "call" the Flash control "directly" or send a message to it.

Thank you in advance.

Best regards,
Simeon

sinfiniti
May 28th, 2002, 09:43 AM
using javascript you can set variables in swf's like this:
1- give the swf an object name...
let's call it 'swf1'
2- pass the variable or value...
document.swf1.myVariable = "myValue";
or...
document.swf1.myVariable = myJavascriptVariable;

you can replace 'document' with the name of the frame/window in order to pass variables from different frames/windows.
:)
jeremy

SimeonPanev
May 28th, 2002, 09:53 AM
Hi,

Thanks a lot!
Setting a variable is a great start, but can I call a function as well? Or can I monitor the state of this var (the value change) from Flash and do something if it happens?

Regards,
Simeon

sinfiniti
May 28th, 2002, 11:24 AM
you can call functions in swf's from javascript AND you can call javascript functions from swf's.
here's how to call a function in a swf from javascript:
document.swf1.myFunction(myParamaters);
here's how to call a javascript function from flash:
getURL("javascript:myJavascriptFunction("+myParameters+")","_self");

hope that helps!
:)
jeremy