I have a html unordered list as a menu. I want an image in the flash header to change when user clicks different menu items.
Here is the javascript in the header of my html page:
Actionscript Code:
<script language="JavaScript" type="text/javascript">
<!--
function findSWF(movieName) {
if (navigator.appName.indexOf("Microsoft")!= -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function containerToFlash(str) {
findSWF("sample").containerToFlash(str);
}
// -->
</script>
The code embedding the swf:
<object classid="clsid
27CDB6E-AE6D-11cf-96B8-444553540000" width="738" height="245" id="sample">
<param name="movie" value="http://www.monikaviktoria.com/test/wp-content/themes/lace-and-moss/flash/sample.swf" />
<param name="wmode" value="transparent" />
<param name="scale" value="noscale" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="http://www.monikaviktoria.com/test/wp-content/themes/lace-and-moss/flash/sample.swf" width="738" height="245" id="sample">
<param name="wmode" value="transparent" />
<param name="scale" value="noscale" />
<param name="allowScriptAccess" value="always" />
<!--<![endif]-->
<p>Alternative content</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
The 'onclick' function on html link:
Actionscript Code:
<li onclick="javascript:containerToFlash('Hello')"><a class="nav_title" href="#">home</a><br /><span class="sub">begin</span></li>
The actionscript in flash:
Actionscript Code:
import flash.external.ExternalInterface
function flashFunction(str:String):Void {
if (str == undefined) {
_root.myText.text="undefined";
} else {
_root.myText.text = str;
}
}
ExternalInterface.addCallback("containerToFlash", null, flashFunction);
Dynamic text box on stage with instance name 'myText' - always reads 'undefined'.
Any ideas anyone? I've scowered the internet for examples, but they all differ from each other, so I can't pinpoint what I'm doing wrong. I hope someone here can see...
Thanks.