Text Measurements with Flash Actionscript 2

Today I found a great class to help me calculating text metrics in Flash. It’s really nice, you can use it to locate every single word / line etc. in a (for instance) wrapping textField. Actionscript 3 has got nice built in methods for this, but unfortunately, for the current project I need to develop with Actionscript 2. Jack Doyle created a very nice actionscript 2 class for this:



Flash Actionscript XML.send( … ) doesn’t send

Once in a while you require Flash… Well yesterday was such a day :-)
I’m was working on a Flash component that tries to submit data back to the server…
I don’t have a lot of flash experience so I still don’t know all its quirks.

Well I was trying to submit an XML document the following way:

var xml:XML = new XML()
//... fill xml ...
xml.send( '/my/url' );

Well… it didn’t submit! No interaction with the server…
After some searching I discovered this was caching. Always that stupid caching…
So I solved this by adding a timestamp:

xml.send( '/my/url?ts=' + ( new Date() ).getTime() )

Again the timestamp to the rescue…