0 Replies Latest reply on Jan 14, 2008 3:57 AM by itgranny

    xml menu

    itgranny
      Right now i'm just trying to get it to display correctly. The buttons I think i have figured out once i can get the first part.

      I think I'm close, very close, but something's happening. It's either replacing or covering up the previous menu item. I'm suspecting replacing because even larger textfields don't show under the last menu item.

      I think my problem comes with the createMovieClip. I don't think it's unique and I haven't found out how to place it where I want on the stage.

      Here's my actionscript:



      stop ();
      //create menu.
      function generateMenu (myxml)
      {
      var item = myxml.firstChild.childNodes;
      for (var i:Number = 0; i < item.length; i++)
      {
      titleString = item .attributes.title;
      trace (titleString);
      createEmptyMovieClip ("titleButton"+i,10);
      {
      createTextField ("item_txt",4,0,0,100,19);
      item_txt.autoSize = "left";
      item_txt.multiline = true;
      item_txt.wordWrap = true;
      item_txt.selectable = true;
      var my_fmt1:TextFormat = new TextFormat ();
      my_fmt1.color = 0xFF0000;
      my_fmt1.bold = true;
      my_fmt1.font = "Arial";
      item_txt.text = titleString;
      item_txt.setTextFormat (my_fmt1);
      //
      //
      this.createEmptyMovieClip ("button_up",3);
      button_up.beginFill (0xEBA801,100);
      button_up.moveTo (0,0);
      button_up.lineTo (0 + item_txt._width,0);
      button_up.lineTo (0 + item_txt._width,0 + item_txt._height);
      button_up.lineTo (0,0 + item_txt._height);
      button_up.endFill ();
      //
      //
      this.createEmptyMovieClip ("button_down",2);
      button_down.beginFill (0xCD33301,100);
      button_down.moveTo (0,0);
      button_down.lineTo (0 + item_txt._width,0);
      button_down.lineTo (0 + item_txt._width,0 + item_txt._height);
      button_down.lineTo (0,0 + item_txt._height);
      button_down.endFill ();
      //
      }
      }
      };
      //xml function
      var myxml = new XML ();
      myxml.ignoreWhite = true;
      myxml.onLoad = function (success)
      {
      if (success)
      {
      generateMenu (this);
      trace ("success");
      }
      else
      {
      trace ("error load xml");
      }
      };
      myxml.load ("xml1_1.xml");

      and here's the xml. it's simple.



      <menu>
      <item title="Cycles" links=" http://www.webstudio.com.cn"/>
      <item title="Cost in this is going to produce a double lined textbox for sure." links=" http://www.flashden.net"/>
      <item title="Facilities" links=" http://www.flashden.net"/>
      <item title="Basics" links=" http://www.webstudio.com.cn"/>
      </menu>

      I believe it will only take a line or two to get it working. Thanks so much!