PDA

View Full Version : help with javascript interacting with flash


webwalker
03-08-2001, 11:31 AM
I am having some problems with my Javascript sending a value to my flash movie. It's working great in IE but not at all in any version of netscape. You can see what's happening with it at http://www.cylabs.com/new_site
The javascript basicaly tells a text variable (labeled number1) in my movie what it should contain. the text variable then tells the movie to goto and stop on that frame. This keeps the movie synced up with the lower frame html page. I'm sure that the problem is that I'm sure that the issue is that I am not forming my javascript correctly for Netscape but I have tried 3 different methods, all of which work in IE and none work in Netscape. Thanks in advance for the help.

The code is as follows:

head=

<script language = "javascript">
<!--
function UpdateFlashNav(input)
{
parent.frames("top").document.movie.SetVariable("number1", input);
}
//-->
</script>

body=

<body onload="UpdateFlashNav('1')" bgcolor= "#FFFFFF" MARGINHEIGHT="0" TOPMARGIN="0" MARGINWIDTH="0" LEFTMARGIN="0" >

[Edited by webwalker on 03-08-2001 at 07:36 PM]

drZoode
03-11-2001, 02:07 AM
The Flash method (SetVariable) shouldn't work with Netscape 6 (no support for LiveConnect plug-in, until they change their API). But the Flash method should work in Netscape 4.x (unless you're on a Unix box).
Please check if you have set the LiveConnect to TRUE and if the src attribute of your EMBED tag matches with the movie name.(in your case it should be movie)

drZoode
03-11-2001, 03:14 AM
Oops! I've made a mistake. The last phrase should be "...the NAME attribute of your EMBED tag should match the ID attribute of the OBJECT tag."

I think the problem might be related to the name that you have chosen for your upperframe name ("top" is a JavaScript reserved word and refers to the topmost window)
Name your upper frame "myUpperFrame" and try this:

top.myUpperFrame.document.movie.SetVariable("x","y");

instead of referring using parent property you can refer to the frame which contains the Flash movie by using the
"top.childFramesName" approach...

I hope it works...

webwalker
03-11-2001, 01:00 PM
Thanks for responding.
I thought about the top thing too. I had already made that change locally and that didn't fix it. I tried the change that you suggested and again it works fine in IE and will not pass the value of the variable in Netscape. This site is residing on a Unix box but why would it be working with IE and not Netscape if the issue is unix? The whole thing is baffeling to me. Any help would be appreciated. At this point I am considering producing a second more generic movie for netscape users. Thanks again for the help