AS3 - variable datatype from a String value?

Through an XMLSocket, I get a basic datatype as a String value, such as “int”, “String”, “Array”, etc… I would like to instantiate a new variable of the specified datatype. Something along the lines of the following psuedocode:


function createVariable(type:String, value:*):void
{
  var dataTypeRef:* = getDataTypeRef( type );
  var v:dataTypeRef = value;
}

I may be shooting for something completely impossible, but I thought I’d ask…

~JC