the "image changing" would be in response to a numeric value.
text is a String value; it's meaningless in terms of it's value relative another String.
What you need to do is convert the String to a Number.
var myText:String = "10";
var myTextField:TextField = new TextField();
myTextField.text = myText;
box.width = Number(myTextField.text);