3 Replies Latest reply on Mar 19, 2010 3:16 PM by kglad

    Weblinks from within movies?

    dwaynt

      Hi all -

       

      I have posted somthing similar to this, but am also doing the same kind of project to what I have posted in AS2. The problem is, I cannot get weblinks to open within a movieclip (anything deeper than root) from a dynamic text field fed by xml. The mouse howevers over and turns into a hand as if it's read that it's an <a> tag, but it just doesnt open a new window. And if I put that same code on the main stage at root and the clickable item there, it works. I can't find anything about it anywhere. Here is my code:

       

      //create the xml object 
      xmlLoad = new XML();
      xmlLoad.load("items.xml");
      xmlLoad.ignoreWhite = true;
      xmlLoad.onLoad = function(success){
          //if successful
          if(success && xmlLoad.status == 0){        
              //reset the text
              xml_text="";
              xml_text2="";
              //list of items
              var xmlItems:XML = xmlLoad.firstChild.firstChild;
              for (var m = 0; m<xmlItems.childNodes.length; m++) { 
                  //grab each item
                  if (xmlItems.childNodes[m].nodeName == "item") {
                      for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) { 
                          if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
                              //grab the link of the item
                              itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
                          } 
                          if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
                              //grab the title of the item
                              itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();   
                          }
                      }
                      //puts the items in the text field
                      xml_text+= "<a href=\""+itemlink+"\">"+itemtitle+"</a><br><br>";
                      xml_text2+= "<a href=\""+itemlink+"\">Read More</a><br><br>";
                  }   
              }            
          }
          //defines the text field mapping
          title0_txt.htmlText = xml_text;
          link0_txt.htmlText = xml_text2;
      }