Actionscript 3 AS3我需要将字符串从输入转换为AS3对象

Actionscript 3 AS3我需要将字符串从输入转换为AS3对象,actionscript-3,eval,Actionscript 3,Eval,我该怎么做?以下是我所拥有的: function send(input):void{ // input.text = "{key: 'value'}" var x:* = stringToObject(input.text) // then be able to do this var y:* = x.key; // then y must be equal to 'value' trace(y) // this is just a string } 您

我该怎么做?以下是我所拥有的:

function send(input):void{
   // input.text = "{key: 'value'}"
   var x:* = stringToObject(input.text)

   // then be able to do this
   var y:* = x.key;

   // then y must be equal to 'value'
   trace(y) // this is just a string
}

您需要包含JSON库,以便能够将JSON字符串解析为对象

有关更多信息,请参考库