Submenu rollover issue

This is a discussion on Submenu rollover issue within the Macromedia Flash forums in Adobe Tools category; Hi guys, I have a question. In an animation I am working on, I have a menu which I load via an xml file. The problem I have is that when I move the mouse away or I click on a link in the submenu, it does not clear itself and stays on active. How can I make this work? When I add clear_child(inview); to function menuchild_init , that removes the links in the submenu when it's clicked, but the background of the submenu remains active and on top of the animation. What changes to the function are needed to ...

Go Back   Application Development Forum > Adobe Tools > Macromedia Flash

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-10-2008, 07:42 PM
newsvlad
Guest
 
Default Submenu rollover issue

Hi guys,

I have a question. In an animation I am working on, I have a menu which I load
via an xml file.

The problem I have is that when I move the mouse away or I click on a link in
the submenu, it does not clear itself and stays on active. How can I make this
work?

When I add clear_child(inview); to function menuchild_init, that
removes the links in the submenu when it's clicked, but the background of the
submenu remains active and on top of the animation.

What changes to the function are needed to remove the background too?

The script is below:




inview=0;
function menuitem_init(i,label, action) {
item=menuitem.duplicateMovieClip("menuitem" add i,i);
item.label=label;
item._x=10;
item._y=(10+(28*i));

_root.item.button.onRelease = function (){
if (action<>""){
loadMovie(action, "load");
}
}

_root.item.button.onRollOver = function (){
_level0.prova="ciao" add action;
i_temp=this._target.substring(9,10);
if (_root.inview==0) {
_root.inview=i_temp;
} else {
clear_child(inview);
_root.inview=i_temp;
}

for (var j = 0; j<_root.node[i_temp-1].childNodes.length; j++) {
target_temp="_root.menuchild" add i_temp add j;
setProperty(target_temp,_x,140);
setProperty(target_temp,_y,(10+(i_temp*28)+j*28));
setProperty(target_temp,_visible,true);
}

_root.selected_menu.bg_child._height=j*28;
_root.selected_menu._y=10+(i_temp*28);
}
}


function clear_child(inview){
for (var j = 0; j<_root.node[inview-1].childNodes.length; j++) {
setProperty("_root.menuchild" add inview add j,_visible,false);
}
}

function menuchild_init(i,j,label, action) {
item=menuchild.duplicateMovieClip("menuchild" add i add j,i add j);
item.label=label;
item._visible=false;
_root.item.button.onRelease = function() {
if (action.lastIndexOf("http://")>-1 or action.lastIndexOf("mailto")>-1) {
getURL(action,"_blank","post");
} else {
loadMovie(action, "load");
}
}
}


menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.load("menu_structure.xml");
menu_xml.onLoad = function(success) {
if (success) {
_root.root = menu_xml.firstChild;
_root.node = _root.root.childNodes;

for (var i = 1; i <= _root.node.length; i++) {
menuitem_init(i,_root.node[i-1].attributes.name,
_root.node[i-1].attributes.action);

for (var j = 0; j<_root.node[i-1].childNodes.length; j++) {
menuchild_init(i,j,_root.node[i-1].childNodes[j].attributes.name,
_root.node[i-1].childNodes[j].attributes.action);
}
}
}
}

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:57 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.