1 Reply Latest reply on Jul 5, 2011 6:27 PM by BlackOpsRanger

    Styling XML Property

    BlackOpsRanger

      A gentleman within this forum assisted me with the following code. It works perfectly, I just need help styling it. For some reason, the stylesheet I have associated to the XML document will not work with this code. Any thoughts? Thanks in advance!!!

       

      stop();
      //Set Image Properties
      myImageBox.html = true;
      myImageBox.wordWrap = true;
      myImageBox.multiline = true;
      myImageBox.label.condenseWhite = true;
      myImageBox.setStyle("borderStyle","none");
      myImageBox.setStyle("backgroundColor","0xCCCCCC");

       

      // Set TextArea Properties
      myText.html = true;
      myText.wordWrap = true;
      myText.multiline = true;
      myText.label.condenseWhite = true;
      myText.setStyle("borderStyle","none");
      myText.setStyle("backgroundColor","0xCCCCCC");

       

      //Set Link Box Text Area Properties
      myText2.html = true;
      myText2.wordWrap = true;
      myText2.multiline = true;
      myText2.label.condenseWhite = true;
      myText2.setStyle("borderStyle","none");
      myText2.setStyle("backgroundColor","0xCCCCCC");

       

      //Call on External CSS document
      NewItem = new TextField.StyleSheet();
      NewItem.load("featuredItem.css");
      myText.styleSheet = NewItem;
      myText2.styleSheet = NewItem;

       

       

       


      //Load XML Image Properties
      myImageBox.text = "<img src = 'smallShirt.jpg'>";

       

       

       

      //Load XML Properties
      featuredContent = new XML();
      featuredContent.ignoreWhite = true;
      featuredContent.load("featuredItem.xml");
      featuredContent.onLoad = function(success)
      {
              if(success)
              {
                      len=featuredContent.firstChild.childNodes.length;
                      str="";
                      for (i=0;i<len-1;i++){
                          str+=featuredContent.firstChild.childNodes[i].firstChild.nodeValue+"\ n";
                      }
                      myText.text = str;
                      myText2.text = featuredContent.firstChild.childNodes[3];
              }
      }

       

      XML Code

      <featureItem>
          <title>This is the Title!</title>
          <description>Describe the item here</description>
          <price>Put the price of the new item here</price>
          <link><a href="http://charmcity3d.com">View Here</a></link>
      </featureItem>

        • 1. Re: Styling XML Property
          BlackOpsRanger Level 1

          Sorry, here is the CSS file:

           

          title {
              color: #000000;
              font-family: Tahoma, Geneva, sans-serif;
              font-size: 24px;
              font-weight: normal;
              display: block;
              text-align: center;
          }
          description {
            color: #0000FF;
            font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
            font-size: 10px;
            font-weight: normal;
            display: block;
            text-align: center;
          }
          price {
            color: #00FF00;
            font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
            font-size: 12px;
            font-weight: bold;
            display: block;
            text-align: center;
          }
          link {
              color: #000000;
              font-family: Tahoma, Geneva, sans-serif;
              font-size: 12px;
              font-weight: bold;
              display: block;
              text-align: center;
              margin-top: 1em;
          }
          a{
              color: #000000;
              font-family: Tahoma, Geneva, sans-serif;
              font-size: 12px;
              font-weight: normal;
              display: block;
              text-align: center;
              text-decoration: none;
          }
          a:hover{
              color: #FFFFFF;
              font-family: Tahoma, Geneva, sans-serif;
              font-size: 12px;
              font-weight: normal;
              display: block;
              text-align: center;
              text-decoration: underline;
          }