Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
bsnyder2004 #1
Finding the Top Coordinate for an element
I posted a little bit ago about a problem I was having with a rollover menu
effect. I think I know a way to fix the problem but I have been having trouble
getting it to work because I very basically no Javascript. :D I need a way to
calculate the position of an object on my page and then based off that object,
I could use a variable which could be calculated on mousemove to find out where
the object is and then set the variable for the event I need it for. Here is my
scripting so far, it is not working because it now displays the menu all the
time instead of using the variable to find out the onclose function variable.
So now the menu never closes after it has been rolledover. If there is a better
way to do this, please let me know! :D <script type='text/javascript'> <!--
var time = 3000; var numofitems = 6; var menuYmin; var menuYmax; //menu
constructor function menu(allitems,thisitem,startstate){ callname=
'gl'+thisitem; divname='subglobal'+thisitem; this.numberofmenuitems =
numofitems; this.caller = document.getElementById(callname); this.thediv =
document.getElementById(divname); this.thediv.style.visibility = startstate;
} //menu methods function ehandler(event,theobj){ for (var i=1; i<=
theobj.numberofmenuitems; i++){ var shutdiv =eval( 'menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden'; }
theobj.thediv.style.visibility='visible'; } THIS NEXT FUNCITON I ADDED
function globalnavposition(thisitem) { globalnav = 'globalNav' +thisitem;
menuYmin = getpageOffsetTop(globalnav); menuYmax = menuYmin + 64; }
function closesubnav(event){ if ((event.clientY < menuYmin)||(event.clientY >
menuYmax)){ for (var i=1; i<= numofitems; i++){ var shutdiv
=eval('menuitem'+i+'.thediv'); shutdiv.style.visibility='hidden'; }
} } // --> </script> </head> <body
onmousemove='globalnavposition(thisitem);' 'closesubnav(event);'> I know
almost no JavaScript, the code for finding the variable I found from a website
and tried to modify it for what I needed. I don't think it is even working
properly. Thanks so much! You all have been very helpful so far.
bsnyder2004 Guest
-
UI Component derived Coordinate issue
I have an MX component derived from UIComponent. Let's call it Foo. Now Foo has an embedded component, let's call it Bar, that has it's own... -
finding an element in the current document's parent
Hi, I'm trying to use MM's findObj function to get the reference to an object which is in the current document's parent, and I'm being a bit... -
2D to 3D relative coordinate system...
Hi, I'm creating a game which uses 3D characters on a pre-rendered background. I want to enable the user to click on a position on the screen and... -
[HTML::Element] how to read element by element
Hello I read the doc about HTML::Element, but I don't find how to read the tree create by parse() element by element. The doc says the tree looks... -
vector shape coordinate space
Anyone know what the maximum size of the coordinate space + and - for a vector shape. I need to be able to check against this to stop invalid...



Reply With Quote

