# Sending message/calling Flash from C++ or JavaScript

**URL:** https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604
**Category:** flash
**Created:** [May 28, 2002, 1:18pm UTC](https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604 "2002-05-28T13:18:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 28, 2002, 1:18pm UTC](https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604/1 "2002-05-28T13:18:30Z")

</div>

Hi everybody,\r\r\rIn our application we have an embedded Flash control (in a HTML file in our Browser control) that shows some games.\rI 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.\r\rAny ideas how (if possible) this could be acheived? \rI think there is an option to call JavaScript from C++ and then JavaScript call Flash, but that’s looks a bit tricky to me.\rI am new to Flash and wondered is there is a way to “call” the Flash control “directly” or send a message to it.\r\rThank you in advance.\r\rBest regards,\rSimeon

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 28, 2002, 1:43pm UTC](https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604/2 "2002-05-28T13:43:47Z")

</div>

using javascript you can set variables in swf’s like this:\r1- give the swf an object name…\rlet’s call it ‘swf1’\r2- pass the variable or value…\rdocument.swf1.myVariable = “myValue”;\ror…\rdocument.swf1.myVariable = myJavascriptVariable;\r\ryou can replace ‘document’ with the name of the frame/window in order to pass variables from different frames/windows.\r:) \rjeremy

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 28, 2002, 1:53pm UTC](https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604/3 "2002-05-28T13:53:00Z")

</div>

Hi,\r\rThanks a lot!\rSetting 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?\r\rRegards,\rSimeon

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 28, 2002, 3:24pm UTC](https://forum.kirupa.com/t/sending-message-calling-flash-from-c-or-javascript/2604/4 "2002-05-28T15:24:35Z")

</div>

you can call functions in swf’s from javascript AND you can call javascript functions from swf’s.\rhere’s how to call a function in a swf from javascript:\rdocument.swf1.myFunction(myParamaters);\rhere’s how to call a javascript function from flash:\rgetURL(“javascript:myJavascriptFunction(”+myParameters+")","\_self");\r\rhope that helps!\r:) \rjeremy
