1 Reply Latest reply on Oct 10, 2009 8:43 AM by kglad

    CSS XML Help

    samquayle

      Hi i am trying to build a really simple banner that loads from an XML file. The idea was that the client wanted to be able to change things such as font colour, button colour, image links etc but the client would also like to alter the font or font family. I basically want to have a CSS inside the actionscript so that I can set the font family as a variable and change it via the xml. I think this is the best way to do it, or alternatively the client could just adjust an external CSS themselves. So far I have not got this to work and would greatly appreciate any help n loading in CSS in actionscript 2.0 as I have very little experience with it.

       

      Below is the actionscript I already have in place .

       

      ----------------------------------------------------------

       

      1st Frame

      ----------------------------------------------------------

      // Load XML

       

      var xmlItems = new Array();

      langXML = new XML();

      langXML.ignoreWhite = true;

      langXML.load('setup.xml');

      langXML.onLoad = function(sucess) {

              if (sucess) {

                      parseFile(langXML);

                      //trace(menuItems);

      play();

              } else {

      trace("XML problem!");

      }

      };

       

       

      function parseFile(xmlDoc_xml) {

       

              for (var a = 0; a<xmlDoc_xml.firstChild.childNodes.length; a++) {

      // push labels into Array

      xmlItems.push(xmlDoc_xml.firstChild.childNodes[a].firstChild.nodeValue);

      }

      trace(xmlItems);

      }

       

      -------------------------------------------------

      Frame where content loads in :

      -------------------------------------------------

       

       

      // init movie

      textTitle.text = xmlItems[0];

      textsubTitle.text = xmlItems[1];

      imageURL = xmlItems[2];

       

       

      // Create Varible for RGB colour reference

      titleColour = "0x" + xmlItems[3];

       

      trace("titleColour:" + titleColour);

       

       

      new Color(textTitle).setRGB(titleColour);

       

       

      subtitleColour = "0x" + xmlItems[4];

       

      trace("subtitleColour:" + subtitleColour);

       

       

      new Color(textsubTitle).setRGB(subtitleColour);

       

       

      clickURL = xmlItems[5];

       

      buttonColour = "0x"+ xmlItems[6]

       

      new Color(buttonBG).setRGB(buttonColour);

        • 1. Re: CSS XML Help
          kglad Adobe Community Professional & MVP

          to specify a font, you'll need to embed the font.  unless you embed all fonts your client may want to choose, you have a difficult task ahead of you:  dynamically embedding fonts in as2 is no easy task.

           

          you may have other problems but, that's the key to your issue.

          1 person found this helpful