it’s been a while since i needed to do this. nice technique is to use ‘split’ to break the string into an array using the split’s arguments as the deliminator then ‘join’ to stick is back together using joins arg to put between each element. the effect is a search and replace
var str:String = "this is a string with some spaces that need replacing with _"
str = str.split(" ").join("_");
// simple :)
I will remember this one. I just know it’s going to come in useful when I least expect it.