I found this snippet while revisiting some old code, and thought it might help someone else. It's trim() for AS3, and it should work in Flash or Flex.
function trim( s:String ):String
return s.replace( /^([\\s|\\t|\\n]+)?(.*)([\\s|\\t|\\n]+)?$/gm, "$2" );
During a recent project, I had an issue with BulkLoader. I wanted to pause all of the loaders running, then resume them later. Pausing them was easy, as BulkLoader has a static method 'pauseAllLoaders'. But resuming them was another issue. I could resume individual items with resume(), or a whole instance with resumeAll(), but there was no method for resuming all instances.
If you've ever needed to make multiline strings in AS3, you may have found yourself doing something awkward like this:
var s:String = "This is a multiline string\\n";
s += "It has multiple lines.\\n";
s += "Too bad the implementation is weird.";