Flex重置表单

            /**
             * 重置表单
             */
            protected function resetFormHandler(event:MouseEvent):void
            {
                /*清空文本框*/
                //通过反射获得当前MXML中的信息 
                var instanceInfo:XML=describeType(this);
                var properties:XMLList =instanceInfo..accessor.(@type=="spark.components::TextInput");  
                for each(var propertyInfo:XML in properties){
                    //propertyInfo.@name对应着id
                    var propertyName:String =propertyInfo.@name;
                    TextInput(this[propertyName]).text="";
                }
               
                /*清空文本域和提示信息*/
                remark.text="";
                result.text="";
            }

 

你可能感兴趣的:(Flex)