Apache flex Flex:Why can';我不能得到显示对象的子对象吗?
我在访问displayObject的子项时遇到问题。这是我的密码:私人Apache flex Flex:Why can';我不能得到显示对象的子对象吗?,apache-flex,Apache Flex,我在访问displayObject的子项时遇到问题。这是我的密码:私人 function resizeTag(event:MouseEvent):void{ var currTagPos:Number = 1; var theTagBox:DisplayObject = tagCanvas.getChildAt(currTagPos); //i have confirmed that it exists on the stage and has
function resizeTag(event:MouseEvent):void{
var currTagPos:Number = 1;
var theTagBox:DisplayObject = tagCanvas.getChildAt(currTagPos); //i have confirmed that it exists on the stage and has sub-children
trace(theTagBox.getChildAt(0).width);
}
基本上,我想得到:
tagCanvas.getChildAt(currTagPos).getChildAt(0).width;
但它不起作用。感谢您提供的指导:)看起来我需要将其称为DisplayObjectContainer。我改为:
trace((tagCanvas.getChildByName(currTagName) as Canvas).getChildAt(3) as Button);
我找到了这篇文章,它帮助我找到了答案: