This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > April 2006 > Javascript callback to Flash not working in NN/Mozilla





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Javascript callback to Flash not working in NN/Mozilla
pedroponting

2006-04-11, 3:32 am

A bit weird. My site is trying to tell a Flash menu what page it is one so a
pointer will move to the appropriate place on the menu (it has to work this way
in case someone navigates straight onto a page in my site rather than going via
the Flash menu itself). See it http://www.embracethefuture.org.au/test. I have
Flash properly configured with addExternalInterface to allow a call from
Javascript to AS. It works fine in IE, so there's no problem on the Flasg side.
Now as far as I am aware there are two differences between IE and NN in terms
of making JS calls to Flash. Firstly, the object reference has to be via the
document object. That's fine, because the script is definitely finding the
Flash object. And secondly, one needs to include an attribute
swLiveConnect="true" in the <embed> tag. This is there. So why else couldn't NN
recognise the function call to AS (JS console gives the error message
"roo.sendPointer is not a function"). I should mention that this works in FF
but not NN. For completeness, here's the JS code and the code for the Flash
object:

<object class="AC" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
rsion=7,0,0,0" width="250" height="410" id="menu" valign="top">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="animation/menu.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#fed902" />
<embed src="animation/menu.swf" quality="high" bgcolor="#fed902" width="250"
height="410" swLiveConnect="true" name="menu" align="middle" valign="top"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


function setFlashMenu(index) { //'index' is a reference to the menu item
corresponding to this page, where 1st menu item on list is 1, etc.
var menu;
if (parent.parent.frames["menu"]){
if (isIE()){
menu=parent.parent.frames["menu"].menu;
} else {
menu=parent.parent.frames["menu"].document.menu;
}
menu.sendPointer(index); // this tells Flash to send the menu pointer to the
location corresponding to this page.
}
setCommentTopic(index);
}

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews