package com { public class A2 { private var _i:uint = 0; public function A2() { trace(length + "a222222222"); try{ i = 50; }catch(a:Error){ trace("errorxxxxxxxxxx"); } } public function set i(i:uint):void { if(_i > 10){ throw new Error(); }else{ _i = i; } } public function get i():uint{ return _i; } } } 运行: var a22:A2 = new A2(); trace(a22.i); try{ a22.i = 60; }catch(e:Error){trace("error");} trace(a22.i);