Click to See Complete Forum and Search --> : flash and javascript drop down menu problem in opera


bounzer
09-01-2003, 10:04 AM
There is a little problem with Opera and calling JavaScripts from Flash - it doesn't works but it's all ok with MSIE. And thats also ok in non-flash caller of this drop menus from no-Flash HTML.

I have two frames - top frame where is functions called and content frame, where menus are shown.

There is a code sample:

top HTML frame with Flash object:

function top_less_DoFSCommand (cmd, arg)
{
eval ("if (parent.main) parent.main." + cmd + "(" + arg + ")");
}
</script>
<script LANGUAGE=VBScript>
Sub top_less_FSCommand (ByVal cmd, ByVal arg)
call top_less_DoFSCommand (cmd, arg)
end sub
</script>



top HTML frame with no Flash object:

<td><img src="images/bullet.gif"></td>
<td><a class="green" onmouseover="parent.main.ShowMenu('2');" onmouseout="parent.main.HideMenu('2');" href="zapchasti.htm" target="infotext"><img src="images/dot.gif" width="1" height="1" border="0" name="i2" alt="">&nbsp;запасные&nbsp;части&nbsp;</a></td>

...and other callers...



Flash actions:

on (release, rollOver) {
fscommand("ShowMenu", "3");
}
on (rollOut) {
fscommand("HideMenu", "3");
}



My drop down handler

var occupied_header = new Array();
var occupied_menu = new Array();
var menutext = new Array();
var maxmenus = 400;

clientPath = menuPath = this;

for (i = 0; i <= maxmenus; i++)
{
occupied_header = 0;
occupied_menu[i] = 0;
}

function n_GetY (El)
{
var Y = 0;
do
{
Y += El.offsetTop;
} while ((El = El.offsetParent) != null);

return Y;
}

function n_GetX (El)
{
var X = 0;
do
{
X += El.offsetLeft;
} while ((El = El.offsetParent) != null);

return X;
}

function On (id)
{
if (occupied_header[id])
{
if (document.all)
{
var frame = ((id > 5) ? 'main' : 'header');
var TopCoord;
var LeftCoord;

TopCoord = ((id > 5) ? n_GetY (window.parent.frames[frame].document.images["i" + id]) - 5 : 0);

if (window.parent.frames[frame].document.images["i" + id])
{
LeftCoord = n_GetX (window.parent.frames[frame].document.images["i" + id]);
}

winLeft = ((clientPath.document.body.offsetWidth < clientPath.document.body.scrollWidth) ? clientPath.document.body.offsetWidth : clientPath.document.body.scrollWidth);
menuWidth = eval ("clientPath.menu" + id).offsetWidth;

if (LeftCoord + menuWidth > winLeft)
{
LeftCoord = winLeft - menuWidth;
}

if (TopCoord) document.all["menu" + id].style.top = TopCoord;
if (LeftCoord) document.all["menu" + id].style.left = LeftCoord;
eval ("menu" + id).style.visibility = 'visible';
}
}
}

function Off (id)
{
if (!occupied_menu[id] && !occupied_header[id])
{
if (document.all)
{
eval ("menu" + id).style.visibility = 'hidden';
}
}
}

function Turn (id, mode)
{
occupied_header[id] = mode;

if (document.layers || document.all)
{
if (mode)
{
eval ("setTimeout(\"On(" + id + ");\",100)");
}
else
{
eval ("setTimeout(\"Off(" + id + ");\",100)");
}
}
}

function OverMenu (id)
{
eval ("clientPath.MenuTDI" + id).style.backgroundColor = "#FFAE5E";

if (eval ("clientPath.MenuTDA" + id))
{
eval ("clientPath.MenuTDA" + id).src = "images/arrow2.gif";
}
}

function OutMenu (id)
{
eval ("clientPath.MenuTDI" + id).style.backgroundColor = "";

if (eval ("clientPath.MenuTDA" + id))
{
eval ("clientPath.MenuTDA" + id).src = "images/arrow.gif";
}
}

function ShowMenu (id)
{
Turn (id, 1);
}

function HideMenu (id)
{
Turn (id, 0);
}



What's in content frame:

...HTML...

<div id=menu2 style="{position:absolute;top:0;left:15;visibility:hidden;z-index:1;}" onmouseover="ShowMenu('2');occupied_menu[2]=1;" onmouseout="HideMenu('2');occupied_menu[2] = 0;">
<table border=0 cellpadding=1 cellspacing=2>
<tr onmouseover="menuPath.OverMenu(201)" onmouseout="menuPath.OutMenu(201)" onclick="infotext.location.href='pricep_2.html'"><td id=MenuTDI201 class=MenuPopup><nobr>&nbsp;<a target='infotext' href="zapchasti_shop.htm">Магазин запчастей к сельскохозяйственной технике</a></nobr></td></tr>
<tr onmouseover="menuPath.OverMenu(202)" onmouseout="menuPath.OutMenu(202)" onclick="infotext.location.href='pricep_3.html'"><td id=MenuTDI202 class=MenuPopup><nobr>&nbsp;<a target='infotext' href="zapchasti_car.htm">Запчасти к карьерной и дорожностроительной технике</a></nobr></td></tr>
</table>
</div>

[I]...and other divs...
...HTML...