1 Reply Latest reply on Jul 10, 2009 11:39 AM by SalvationD

    Help with adding URL to AS/XML

    SalvationD Level 1

      The XML looks like

       

       

       

           <menu_item name="Contact Me">
                <img filename="contact.swf" title="Contact" thumbnail="sample_th.jpg" or_w="500" or_h="550"><![CDATA[This is a <font color='#999999'>TEST</font> get use to it.]]></img>
           </menu_item>
      

       

       

      and the actionscript in flash looks like :

       

       

      //Load the images in XML file
      //Create arrays to receive values
      image_filename=new Array();
      image_thumbnail=new Array();
      image_description=new Array();
      image_category = new Array();
      image_or_w=new Array();
      image_or_h=new Array();
      image_title=new Array();
      filepath="items/";//Place here the relative path directory to your images
      var xml_file = new XML();
      xml_file.ignoreWhite = true;
      xml_file.onLoad = function()
      {
           var categories = xml_file.firstChild.childNodes;
           k=0;//Variable to control categories
           l=0;//Variable to control first position of each category
           for (var j=0; j<categories.length; j++)
           {//Each category
                var nodes:Array=categories[j].childNodes;
                if (j==0){_global.category=categories[j].attributes.name;}
                for(var i=0;i<nodes.length;i++)//Retrieve picture information
                {
                     image_filename.push(nodes[i].attributes.filename);
                     image_thumbnail.push(nodes[i].attributes.thumbnail);
                     image_description[k]=nodes[i].firstChild.nodeValue;
                     image_title.push(nodes[i].attributes.title);
                     image_or_w.push(nodes[i].attributes.or_w);
                     image_or_h.push(nodes[i].attributes.or_h);
                     image_category[k]=categories[j].attributes.name;
                     k+=1;//Increase k value
                }
      

       

       

       

      ------ Other code OMITTED (for space) ------

       

       

                mov_top_menu["mov_button"+j].but_category.onRelease = function() //Click button event
                {//User clicks button
                     if (_global.category!=this._parent.txt_cat && this._parent._parent._parent._currentframe==5)
                     {
                          position=this._parent.f_pos;//Change image position to the first of selected set
                          _global.category=this._parent.txt_cat;//Change selected category
                          mov_top.desc_txt.slideTo(x,-15,0.5);
                          image.alphaTo(0,0.6,"linear",0,function(){this._parent.gotoAndPlay(3)});//Recreate thumbs
                          mov_lower.thumb.stopTween();
                     }
                }
      

       

       

       

       

      I'm wanting to make 1 or 2 menu items be a link, 1 to the forum part of the website (~/forum/) and the other part to (~/family/)

       

      I know I need to add something in the actionscript.. just not sure HOW.. since this is all an array.. would I need to just add..

       

      image_getURL=new Array(); // in arrays

       

      and

       

      image_URL.push(nodes[i].attributes.getUrl);

       

      & hopefully the XML looks like this:

       

      <menu_item name="Contact Me" getUrl="www.google.com">

      </menu_item>

       

      but wheN I do this in the XML it doens't work at all on the website.. so obviously I need to add something into the AS.. but i'm not sure what.

      Seems so complicated to just add a single link.. argh.. help?