I am communicating between the html and flash object. My goal is to populate the flash object textbox with the value of the html combobox (I know this is silly, but again its a test that is going to lead up to a much more involved project).
So, the javascript below works to a certain extent...
The problem is with the line: var testVar = document.myForm.department.value;
I want the variable, testVar, to equal the value of which ever option the user selects from the combobox. The way it is setup now, the variable will not update! (it will only send the initial value to flash i.e. "Accounting").
Check it out online! http://www.dajunkyard.com/USGtestser...ceExample.html
Expand|Select|Wrap|Line Numbers
- <body>
- <form name="myForm">
- <TR>
- <TD>Department:</TD>
- <TD>
- <SELECT NAME="department">
- <option value="accounting">Accounting</option>
- <option value="human_resources">Human Resources</option>
- <option value="information_technology">Information Technology</option>
- <option value="marketing">Marketing</option>
- <option value="sales">Sales</option>
- <option value="support staff">Support Staff</option>
- </select>
- </form>
- </TD>
- </TR>
- <form>
- <input type="button" onclick="callExternalInterface()" value="Call ExternalInterface" />
- </form>
- <script>
- var testVar = document.myForm.department.value;
- function callExternalInterface() {
- thisMovie("externalInterfaceExample").goHome(testVar);
- }
- function thisMovie(movieName) {
- if (navigator.appName.indexOf("Microsoft") != -1) {
- return window[movieName]
- }
- else {
- return document[movieName]
- }
- }
- </script>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="externalInterfaceExample" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400">
- <param name="movie" value="test.swf" />
- <param name="quality" value="high" />
- <embed src="test.swf" name="externalInterfaceExample" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed>
- </object>
- </body>