A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Submenu rollover issue

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Posts
    18

    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.

    Here is the action script I use:
    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);
    }
    }
    }
    }
    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?
    Do you or your clients need an ecard site/marketing campaign? We have content!
    http://www.cardsup.com/webcontent.php

  2. #2
    Junior Member
    Join Date
    Sep 2003
    Posts
    18
    Anyone? As you can tell, I am not a programmer, so any help is appreciated!!! :-)

    OK, when I add clear_child(inview);

    Code:
    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 {
    clear_child(inview);
    loadMovie(action, "load");
    }
    }
    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?

    Ideally, the submenu should disappear on click or mouseOut, but for now I will be happy at least with the on click...

  3. #3
    Junior Member
    Join Date
    Sep 2003
    Posts
    18
    argh... I am close to my deadline, and this still does not work...
    Do you or your clients need an ecard site/marketing campaign? We have content!
    http://www.cardsup.com/webcontent.php

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center