Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Oi Pessoal,
Eu peguei na net um combobox que lê um arquivo XML e gostaria que os texto ficassem alinhados a direita e onde eu pudesse colocar algumas palavras em negrito , eu pesquisei o CData mas ñ consegui implementar vou colocar abaixo os codigos da action e do xml.
action
import mx.utils.Delegate;
// declare variables
var people:Array;
var update:String;
var dirpath:String;
// set up the XML instance
var peoplexml:XML = new XML();
// initialize items on stage
_global.style.setStyle("fontFamily", "Verdana");
_global.style.setStyle("fontSize", 11);
function onXmlLoaded(success:Boolean) {
if (success) {
var mainnode:XMLNode = peoplexml.firstChild;
update = mainnode.attributes.lastupdate;
dirpath = mainnode.attributes.dir;
var peoplenodes:Array = peoplexml.firstChild.childNodes;
for (var i:Number = 0; i < peoplenodes.length; i++) {
var personnode:XMLNode = peoplenodes*;*
people.push(
{i:i+1,
pname:personnode.attributes.name
});
}
setup();
} else {
trace('error reading XML');
}
}
function setup() {
// set up chooseperson dropdown
chooseperson.labelField = "pname";
chooseperson.dataProvider = people;
chooseperson.addEventListener("change", Delegate.create(this, loadScreen));
}
function loadScreen(evt:Object) {
var thisitem:Object = evt.target.selectedItem;
ta.text = thisitem.desc;
ta.vPosition = 0;
bgcol.setRGB(thisitem.bgcolor);
}
function init() {
// initialize the people array
people = [{pname:"Ramais"}];
// set up the xml instance to ignore whitespace between tags
peoplexml.ignoreWhite = true;
// set the scope of the onLoad function to the main timeline, not peoplexml
peoplexml.onLoad = Delegate.create(this, onXmlLoaded);
// start the xml loading
peoplexml.load("people.xml");
}
init();
XML
*<?xml version="1.0" encoding="utf-8"?>*
*<people lastupdate="9/14/2005" dir="">*
* <person name="PRESIDENTE">*
* </person>*
* <person name="Pedro - 4190" >*
* </person>*
<person name="GERÊNCIA"
* </person>*
* <person name="Beninca - 4101">*
* </person>*
* <person name="F. Petry - 4131" >*
* </person>*
* <person name="Paula - 4123" >*
* </person>*
*</people>*
*<person name="FINANCEIRO" >*
* </person>*
* <person name="Alexsandra - 4143" >*
* </person>*
* <person name="Elisabete - 4144" >*
* </person>*
* <person name="Livre - 4770" >*
* </person>*
* <person name="Luana - 4169" >*
* </person>*
* <person name="Naiara - 4141" >*
* </person>*
*</people>*Carregando comentários...