Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash 容器中的Flex-detect元素_Flash_Apache Flex - Fatal编程技术网

Flash 容器中的Flex-detect元素

Flash 容器中的Flex-detect元素,flash,apache-flex,Flash,Apache Flex,如何检测容器中是否有任何元素 示例代码: <s:VGroup id="myGroup"></s:VGroup> if(myGroup.getElementAt(0)){ //Got element inside }else{ //Nothing inside } 如何检测是否有任何元素加载到VGroup中 谢谢。使用酒店 if(myGroup.numChildren > 0){ //Got element inside }else{

如何检测容器中是否有任何元素

示例代码:

<s:VGroup id="myGroup"></s:VGroup>

if(myGroup.getElementAt(0)){
    //Got element inside
}else{
    //Nothing inside
}
如何检测是否有任何元素加载到VGroup中

谢谢。

使用酒店

if(myGroup.numChildren > 0){
    //Got element inside
}else{
    //Nothing inside
}

虽然答案很简单,但我不确定自己是否理解这样做的理由。为什么你的“父母”需要反省孩子?
if(myGroup.numChildren > 0){
    //Got element inside
}else{
    //Nothing inside
}