Apache flex 是否可以将背景图像放置到组件';集团';用CSS?怎么用?

Apache flex 是否可以将背景图像放置到组件';集团';用CSS?怎么用?,apache-flex,flex4,skinning,Apache Flex,Flex4,Skinning,在组件“组”中,我一次拖动多张图片,我需要清理此组件,但包含组件位图图像,我将不会被擦除: <s:Group id="droppedImages" width="100%" height="100%"> <s:BitmapImage id="bg" source="@Embed('lineal2.jpg')" width="1024" height="577" verticalCenter="0"/> </s:Gro

在组件“组”中,我一次拖动多张图片,我需要清理此组件,但包含组件位图图像,我将不会被擦除:

        <s:Group id="droppedImages"  width="100%" height="100%">
        <s:BitmapImage id="bg" source="@Embed('lineal2.jpg')" width="1024" height="577" verticalCenter="0"/>
        </s:Group>
我会尝试这样的方式:

while (droppedImages.numChildren > 1 ) { 
    if(droppedImages.getChildAt(0).name != 'bg'){
        droppedImages.removeChildAt(0)
    }
}

感谢您的帮助

我看到的主要问题是您混淆了“儿童”和“元素”。它们是不兼容的数字。

我很困惑。您正在尝试从组中删除所有子项吗?或者您正在尝试删除除BitMapImage之外的所有子项?还是你想做点别的?是否存在无法删除BitMapImage的问题?或者别的什么?嗨,我正在尝试删除所有的子对象,除了位图图像。我用一种简单的双重方式解决:)while(droppedImages.numChildren>1)droppedImages.removeElementAt(1);一般来说,这是一种不好的做法,因为子元素的数量并不总是等于元素的数量。这可能在您的特定用例中起作用,但不要让它成为一种习惯。您应该使用
numElements
而不是
numChildren
while (droppedImages.numChildren > 1 ) { 
    if(droppedImages.getChildAt(0).name != 'bg'){
        droppedImages.removeChildAt(0)
    }
}