Input boxes and selections

I’m trying to do some slightly more complex and strange things with input boxes

say you had some writing in an input box and you wanted to find out what characters were before the flashing cursor thing (looks like “|”). Does anyone know how in as2 or as3 (im going to make a copy in both so any help would be nice :D)




(love that smilie)