我在图书馆里有一个符号,在舞台上我有十二个符号对象。每个符号都有一个实例名称,来自 al
另外我有十二个对象(图像)实例名称,从 1-12
我单击了图像的一个对象,我可以从数组中提取名称对象(al),但不能访问 while。
如何在 as3 中将字符串转换为实例名称
var abc:Array = ["0","a","b","c","d","e","f","g","h","i","j","k","l"];
function item_onMouseUp(event:MouseEvent):void
{
var clip:Sprite = Sprite(event.currentTarget);
var c:int = int(clip.name);
trace("abc[c]=" +[abc[c]]);
//The problem here
if (clip.hitTestObject([abc[c]]))
{
trace("===");
}
clip.stopDrag();
}
例如在我得到的跟踪胜利中
abc[c]=d
TypeError: Error #1034: Type Coercion failed: cannot convert "d" to flash.display.DisplayObject.
at gamewitoutserver_fla::MainTimeline/item_onMouseUp()