Access variable via String

Is there a way to access a variable via a String? Something like this:


var myVar1:Int = 1
var myVar2:Int = "myVar1" as variable name

This is obviously doesn’t work (and in this case pointless), but is there a way to do this?