Followed a tutorial for an XML menu, need two menus, can't

  • Ifrit
  • Graduate
  • Graduate
  • User avatar
  • Posts: 196
  • Loc: Portugal

Post 3+ Months Ago

I didn't post this on that tutorial thread because people have had some questions that were unanswered over there and I'm afraid this question might get lost somewhere unless I do this...

So basically I've successfully made an XML menu on flash using the mentioned tutorial on this site:
http://www.daniweb.com/tutorials/tutorial72820.html

My question whereas it might have a simple solution... is something that i've been trying to figure out for days now and i'm starting to feel desperate!

I simply need two menus, different xml files and different styles... I've accomplished this... however when one menu shows up, the previously loaded one simply disappears... I went as far as changing every variable on the duplicated menu but to no avail... made new MCs with different names and still cant do it...

Can anyone help me?

I do not have the FLA from where I am at the moment, but you can check the SWF at http://demos.webfocus.com.pt/carlos/

You will see a vertical menu pop up (gray color menu) at the bottom of the page, OR a red menu, one of them will definitely pop up but never both of them.. whichever loads last will show up, the links are "undefined" right now but that is expected.

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

I'm only getting a little text that says undefined for everything making me think that its probably not actually working. Any chance you want to post your actionscript code here?
  • Ifrit
  • Graduate
  • Graduate
  • User avatar
  • Posts: 196
  • Loc: Portugal

Post 3+ Months Ago

that is actually expected singe the links themselves are not properly working yet, its not relevant to the issue

here's the script...

Code: [ Select ]
function xmlLoadMenu(loaded) {
    if (loaded) {
        now._visible = false;
        xmlNode = xmlData.firstChild;
        total = xmlNode.childNodes.length;
        name = [];
        link = [];
        Target = [];
        for (i=0; i<total; i++) {
            name[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
            Target[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
            _parent.createEmptyMovieClip("_button", i);
            _parent._button.attachMovie("button", button+i, i);
        }
        
    _parent._button._x = Stage.width / 2;
    _parent._button._y = _root.logotipo._y + 380;

        // end of for
    } else {
        now._visible = true;
        now._width = _root._width-10
        now._height=(1/7.74)*now._width
    }
    // end if
}
// End of the function


xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load("menu.php");
xmlData.onLoad = xmlLoadMenu;
  1. function xmlLoadMenu(loaded) {
  2.     if (loaded) {
  3.         now._visible = false;
  4.         xmlNode = xmlData.firstChild;
  5.         total = xmlNode.childNodes.length;
  6.         name = [];
  7.         link = [];
  8.         Target = [];
  9.         for (i=0; i<total; i++) {
  10.             name[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  11.             link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  12.             Target[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
  13.             _parent.createEmptyMovieClip("_button", i);
  14.             _parent._button.attachMovie("button", button+i, i);
  15.         }
  16.         
  17.     _parent._button._x = Stage.width / 2;
  18.     _parent._button._y = _root.logotipo._y + 380;
  19.         // end of for
  20.     } else {
  21.         now._visible = true;
  22.         now._width = _root._width-10
  23.         now._height=(1/7.74)*now._width
  24.     }
  25.     // end if
  26. }
  27. // End of the function
  28. xmlData = new XML();
  29. xmlData.ignoreWhite = true;
  30. xmlData.load("menu.php");
  31. xmlData.onLoad = xmlLoadMenu;


and this bit goes on the MC that is actually each separate link:

Code: [ Select ]
onClipEvent (load) {
    deep = _parent.getDepth();
    this._x = 0;
    this._y = 20+deep*(this._height+2);
    getLink = _parent._parent._parent.link[deep];
    getlabel = _parent._parent._parent.name[deep];
    getTarget = _parent._parent._parent.Target[deep];
    this.label_1.label_1.text = getlabel;
}
on (release) {
    
    
    unloadMovie(_root.fullImage_mc);
    unloadMovie(_root.container_mc);
    

    
    filename = "gallery.php?item_ID=" + getLink;
    _root.myGalleryXML.load(filename);

}
on (rollOver) {
    this.gotoAndPlay(2);
}
on (rollOut) {
    this.gotoAndPlay(16);
}
  1. onClipEvent (load) {
  2.     deep = _parent.getDepth();
  3.     this._x = 0;
  4.     this._y = 20+deep*(this._height+2);
  5.     getLink = _parent._parent._parent.link[deep];
  6.     getlabel = _parent._parent._parent.name[deep];
  7.     getTarget = _parent._parent._parent.Target[deep];
  8.     this.label_1.label_1.text = getlabel;
  9. }
  10. on (release) {
  11.     
  12.     
  13.     unloadMovie(_root.fullImage_mc);
  14.     unloadMovie(_root.container_mc);
  15.     
  16.     
  17.     filename = "gallery.php?item_ID=" + getLink;
  18.     _root.myGalleryXML.load(filename);
  19. }
  20. on (rollOver) {
  21.     this.gotoAndPlay(2);
  22. }
  23. on (rollOut) {
  24.     this.gotoAndPlay(16);
  25. }
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

I'm not entirely sure but I think what's happening is that your xml data function is overwriting itself.

You actually need to declare two different variables for your xml data and two functions so:
ACTIONSCRIPT Code: [ Select ]
xmlData = new XML();
xmlData2 = new XML();
xmlData.ignoreWhite = true;
xmlData2.ignoreWhite = true;
xmlData.load("menu.php");
xmlData2.load("menu2.php");
xmlData.onLoad = xmlLoadMenu;
xmlData2.onLoad = xmlLoadMenu2;
 
  1. xmlData = new XML();
  2. xmlData2 = new XML();
  3. xmlData.ignoreWhite = true;
  4. xmlData2.ignoreWhite = true;
  5. xmlData.load("menu.php");
  6. xmlData2.load("menu2.php");
  7. xmlData.onLoad = xmlLoadMenu;
  8. xmlData2.onLoad = xmlLoadMenu2;
  9.  


Typically there are two things that would cause what your seeing. Different things being loaded into the same variable or different functions trying to do something with the same movieclip instance name. I guess I'd check both.
  • Ifrit
  • Graduate
  • Graduate
  • User avatar
  • Posts: 196
  • Loc: Portugal

Post 3+ Months Ago

Thanks, that is something I have already tried aswell as changing function names even making a duplicate of the code with all-different var names and functions in a different MC... it still doesn't work, what could I be missing...

(i tried to fix the title, looks ridiculous, how can i do it?)
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Did you get this working? If not you might want to post more of your code so I can take a deeper look.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.