2 Replies Latest reply on Jan 11, 2008 10:07 AM by Nevermynd

    help with flash/xml menu please

    Nevermynd Level 1
      Hello

      I am a beginner to intermediate flash user....been using it for a few years now but never anything too complex. Trying to learn more flash and xml while working on a project and wanting to use a cool menu I downloaded.

      Can someone help me with the needed (missing) code in both the xml and the actionscript to make the buttons actually link to a web page? Below is the xml and actionscript and I am hoping that is enough without the actual flash file....but if needed I can post it.

      My guess is there needs to be some sort of attribute.link in the actionscript that links up to link = " http://yahoo.com" in the xml but not quite sure how to do it.

      Thanks for the help!

      XML code

      <?xml version="1.0" encoding="iso-8859-1"?>

      <item nazov="button num 1 "load="" image=""/>

      <item nazov="button num 2" load="" image=""/>

      <item nazov="button num 3" load="" image=""/>

      <item nazov="button num 4" load="" image=""/>

      <item nazov="button num 5" load="" image=""/>

      <item nazov="button num 6" load="" image=""/>


      ACTIONSCRIPT

      _parent.butts.alphaTo(50,1);

      function goFrame(mc):Void {
      delete this.onEnterFrame;
      if (mc._currentframe < mc._totalframes) {
      mc.onEnterFrame = function() {
      mc.nextFrame();
      if (mc._currentframe == mc._totalframes) {
      delete mc.onEnterFrame;
      }
      };
      }
      }
      function backFrame(mc):Void {
      delete mc.onEnterFrame;
      mc.onEnterFrame = function() {
      mc.prevFrame();
      if (mc._currentframe == 1) {
      delete mc.onEnterFrame;
      }
      };
      }

      this._lockroot = true;

      menu1XML = new XML();
      menu1XML.ignoreWhite = true;
      menu1XML.load("menu1.xml");
      menu1XML.onLoad = function(success) {
      if (success) {
      keyNode = menu1XML.childNodes;
      pocet = keyNode.length;
      _global.mnozstvo1 = pocet;
      _global.riadok1 = 16;

      for (i = 0; i < pocet; i++)
      {
      button.duplicateMovieClip('b' + i, _root.getNextHighestDepth());
      b = _root['b' + i];
      b.i = i;
      b._y += i * _global.riadok1;
      b.text2.text = menu1XML.childNodes .attributes.nazov;
      b.text1.text = menu1XML.childNodes
      .attributes.nazov;
      _global.selecionado = 0;

      b.onRollOver = function()
      {
      var ID = this._y;
      var som:Sound = new Sound();
      som.attachSound("som");
      som.start();
      goFrame(this);
      pointermenu.tween("_y",ID,1,"EaseOutExpo");
      _parent.vysunbtn1.tween("_x",124,1,"EaseOutExpo");
      _parent.butts.alphaTo(100,1);
      };

      b.onRollOut = function()
      {
      backFrame(this);
      _parent.vysunbtn1.tween("_x",100,1,"EaseOutExpo");
      _parent.butts.alphaTo(50,1);
      };

      b.onRelease = function()
      {
      _global.selecionado = this.i;
      this.enabled = false;
      this.useHandCursor = false;
      fcn();

      _parent._parent._parent.content.tween("_y",175,1,"EaseOutExpo");
      _parent._parent._parent.content.headcon.headert.text = "AHOJ";
      backFrame(_parent._parent._parent.content);
      goFrame(_parent._parent._parent.content);

      _global.section = menu1XML.childNodes[this.i].attributes.load;

      };
      unloadMovie(button);
      }
      }
      }

      function fcn()
      {
      for (i = 0; i < pocet; i++)
      {
      if (i != selecionado)
      {
      _root['b' + i].enabled = true;
      _root['b' + i].useHandCursor = true;
      backFrame(_root['b' + i]);
      }
      }
      }

      this.onEnterFrame = function()
      {
      var pctLoaded:Number = Math.floor(menu1XML.getBytesLoaded() / menu1XML.getBytesTotal() * 100);
      if (!isNaN(pctLoaded))
      {
      pointer._xscale = pctLoaded;
      pointer.text = pctLoaded + "% loaded";
      if (pctLoaded >= 100)
      {
      delete this.onEnterFrame;
      }
      }
      };


        • 1. Re: help with flash/xml menu please
          niki tsanov Level 1
          Try with this make movieclip and set some linkageID after that into the movieclip make one button and that much textfileds that is the fields from the xml , with your xml that mean 3 text fields nazov,load,image after that when you load the xml file and get the childNodes just use attachMovie clip with the button and textfields inside and put into new attachedMovie clip the information from XML.The priority is that they you have movieclip into the library and inside the movieclip you can put the code that command the movieclip to open new URLs and other things without to puttin some events when xml load new items.Cheers! :)
          • 2. Re: help with flash/xml menu please
            Nevermynd Level 1
            Thanks Niki but I think your reply was a bit over my head.

            I guess I was hoping someone might be able to alter the actual codes for me without too much hassle and I can learn from that. First, I am wondering if links can be applied just by changing the xml ONLY.......or does code also need to be added the actionscript?

            This is where the actual example and file can be found.

            http://www.ffiles.com/flash/menus/4_xml_menus_1118.html