swapChildren()因2025错误而崩溃

时间:2011-01-22 18:42:02

标签: flex actionscript-3

我正在尝试通过交换来更改对象显示顺序,但是在最后一行程序崩溃时出现错误“ArgumentError:错误#2025:提供的DisplayObject必须是调用者的子项。”

var en:DisplayObject  = this.getChildByName("engine");
var cpt:DisplayObject = this.getChildByName("bg_image");

if (en && cpt)
{
     if (en.parent == cpt.parent)
          en.parent.swapChildren(en, cpt);
}

对象似乎有相同的父级,我不知道这里可能有什么问题。在flex 3.2上编码

0 个答案:

没有答案