Search And Replace Problem

  • saveth
  • Born
  • Born
  • saveth
  • Posts: 2

Post 3+ Months Ago

I'm having trouble setting my text box correctly after I do a search and replace. Should be obvious but my variable that I'm passing in is called songTitle and the text box instance name is songTitle_txt. Here is my current code. Any help would be appreciated.

Code: [ Select ]
function loadXML(loaded) {
  if (loaded) {
    xmlNode = this.firstChild;
    var songTitle:String = xmlNode.childNodes[8].childNodes[0];
    songTitle = xmlNode.childNodes[8].childNodes[0];
    songTitle = songTitle.searchReplace(" - ", ": ");
    songTitle = songTitle_txt.text.toUpperCase();
  } else {
    content = "file not loaded!";
  }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.crylounge.com/shoutcast.php");

String.prototype.searchReplace = function(find, replace) {
  var myarray = this.split(" ");
  for (var i = 0; i<myarray.length; i++) {
    if (myarray[i] == find) {
      myarray[i] = replace;
    }
  }
  return myarray.join(" ");
};
  1. function loadXML(loaded) {
  2.   if (loaded) {
  3.     xmlNode = this.firstChild;
  4.     var songTitle:String = xmlNode.childNodes[8].childNodes[0];
  5.     songTitle = xmlNode.childNodes[8].childNodes[0];
  6.     songTitle = songTitle.searchReplace(" - ", ": ");
  7.     songTitle = songTitle_txt.text.toUpperCase();
  8.   } else {
  9.     content = "file not loaded!";
  10.   }
  11. }
  12. xmlData = new XML();
  13. xmlData.ignoreWhite = true;
  14. xmlData.onLoad = loadXML;
  15. xmlData.load("http://www.crylounge.com/shoutcast.php");
  16. String.prototype.searchReplace = function(find, replace) {
  17.   var myarray = this.split(" ");
  18.   for (var i = 0; i<myarray.length; i++) {
  19.     if (myarray[i] == find) {
  20.       myarray[i] = replace;
  21.     }
  22.   }
  23.   return myarray.join(" ");
  24. };


Thanks,
Saveth
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

shouldnt it be:
songTitle_txt.text = songTitle.toUpperCase(); ?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.