递归调用---注意什么条件退出递归
2009-06-22 17:04
225 查看
public function resetToBlank(children:Array):void{
if(children.length>0){
for(var i:int=0;i<children.length;i++){
//如果是Container,才递归
if(children[i] is Container){
var container:Container=children[i] as Container;
//DisplayObjectContainer没有getChildren() 方法,Container才有
if(container.getChildren().length>0){
resetToBlank(container.getChildren());
}
}else{
var component:DisplayObject=children[i] as DisplayObject;
var componentInfo:Object = ObjectUtil.getClassInfo(component);
if(componentInfo.name == "mx.controls::ComboBox"){
component["selectedIndex"]=0;
}else if(componentInfo.name == "mx.controls::TextInput" || componentInfo.name == "mx.controls::DateField"){
if(component.hasOwnProperty("text"))component["text"]="";
}
}
}
}
}
if(children.length>0){
for(var i:int=0;i<children.length;i++){
//如果是Container,才递归
if(children[i] is Container){
var container:Container=children[i] as Container;
//DisplayObjectContainer没有getChildren() 方法,Container才有
if(container.getChildren().length>0){
resetToBlank(container.getChildren());
}
}else{
var component:DisplayObject=children[i] as DisplayObject;
var componentInfo:Object = ObjectUtil.getClassInfo(component);
if(componentInfo.name == "mx.controls::ComboBox"){
component["selectedIndex"]=0;
}else if(componentInfo.name == "mx.controls::TextInput" || componentInfo.name == "mx.controls::DateField"){
if(component.hasOwnProperty("text"))component["text"]="";
}
}
}
}
}
相关文章推荐
- 递归退出的条件
- 根据先序和中序求后序,注意递归终止条件
- LeetCode 112. Path Sum 注意递归的终止条件
- 【郝斌数据结构自学笔记】53-56_一个函数为什么可以自己调用自己_递归必须满足三个条件_循环和递归的比较
- 收藏:偶要用delphi写几个dll来公开发布出去,让其他工具的程序员调用。应该注意些什么事项 关键字:分类 :个人专区密级 :公开
- return在递归调用时需注意的地方
- 错误锦集一:循环退出条件(递归退出条件)
- 在treeview的递归算法中,它是根据什么退出递归呢?
- 深拷贝和浅拷贝的区别?如果要delete一个浅拷贝,需要注意什么条件?
- 返回多个不同类型参数的值(out)可变参数一维数组( params )把值从方法中带出(ref) 方法递归(方法自己调用自己与循坏类似注意return每次只能跳出一个方法))
- Activity报错退出会调用什么生命周期
- java实现树的节点之间距离;向下递归,注意找到一个满足条件的节点要break
- js递归调用注意return返回值
- ajax异步访问中调用session和服务器控件的条件注意的问题
- 把.h和.cpp文件变为.so库供Android端调用需要注意什么?
- Android关于 手机返回键和代码finish()方法退出activity他们有什么区别;当activity使用共享动画时应该调用哪个方法,结束activity
- java递归调用注意点
- js递归调用注意return返回值
- Tip:判断条件与数据库相关时,需要注意什么。要尊重字段原本的意义
- 解决在IIS中调用Microsoft Office Excel组件后进程无法正常退出的问题