PDA

View Full Version : passign a command to a flash movie in another frame


trikota
09-30-2002, 02:13 AM
OK. So here is a problem.
I have a frameset with a flash menu in one frame and the html pages in another (main). Onload of the main frame I want to pass a variable to a flash movie.

If menu was in the same frame, the command would look like this:

function setFlash(a,b,c)
{
window.document.gMovie.SetVariable ("_root.code.aSelect", "" + a);}

That works fine.
I am not sure how to talk to the movie in another frame.

Please, help.

glenngv
09-30-2002, 04:48 AM
top.frames["FrameNameHere"].document.gMovie.SetVariable ("_root.code.aSelect", "" + a);

trikota
09-30-2002, 05:01 AM
In Netscape 4.7 I am getting an error:
top.frames.nav.document.gMovie has no properties.

It works all right on IE6, but then almost everything works on ie6.

glenngv
09-30-2002, 05:04 AM
does your original code work in NS if it's in the same frame?

adios
09-30-2002, 05:11 AM
Does your HTML look like this?

<object............><embed name="gMovie"........></object>

Anything absolutely positioned (Layer)?

trikota
09-30-2002, 05:15 AM
>>does your original code work in NS if it's in the same frame?

Yes. At least in NS4.7.

>><object............><embed name="gMovie"........></object>

The html for the flash menu does. That is pretty much all there is in that file. Just imbedded flash.

adios
09-30-2002, 05:22 AM
Here's a problem:

top.frames.nav.document.gMovie has no properties.

...means: "found the top item in the frameset, got that frames[] array, OK on the 'nav' frame, there's that document, and...oops - what's a 'gMovie'?" If it found a document property from within the document, the extended hierarchial reference should work too. At least, that's the theory...

trikota
09-30-2002, 05:30 AM
Thanks for making it clear.
I went to the menu html file and doubled the names : called a name and id gMovie. And it worked!

Thanks a lot adios and glenngv.
It was a great help.

trikota
10-07-2002, 07:26 PM
This is the code for the page.
It works fine on Netscape 4.7 and IE 6. But not on Mac IE5.5 and PC IE5. I don't kow what it is. Please, help.

<html>
<head>
<title>title</title>

<script><!--
var imageData = [
['empa_fullquote01.jpg','empa_quote01.jpg','280','540'],
['empa_fullquote02.jpg','empa_quote02.jpg','280','485'],
['empa_fullquote03.jpg','empa_quote03.jpg','280','474'],
['empa_fullquote04.jpg','empa_quote04.jpg','280','540'],
['empa_fullquote05.jpg','empa_quote05.jpg','280','540'],
];
var imgRoot = "images/";
var picked = new Array();
for (var i=0; i<imageData.length-1; picked.push(0), i++);

function showPopup(i) {
var f = 'width=' + imageData[i][2] + ',height=' + imageData[i][3];
window.open(imgRoot+imageData[i][0],'picWin', f);
}

function insertRandomImgs(qty) {
var p = 0;
while (p < qty) {
var i = Math.floor(Math.random() * imageData.length);
if (picked[i] == 0) {
document.write('<a href="#" onClick="showPopup('+i+'); return false"><img src="'+imgRoot+imageData[i][1]+'" style="cursor:hand" alt="'+imageData[i][0]+'" border=0></a>');
picked[i] = 1;
p++;
}
}
}
// -->
</script>

</head>

<body>
<script>
insertRandomImgs(1);
</script>

</body>
</html>