Sprite에서 너비를 재정의하는 방법이 있습니까?x, y, 너비 및 높이 재정의 (getters)
내가 세터가 아니라 게터
을 무시하는 방법의 예 내가
override public function get width():Number {
if (onecase) {
return this width;
} else {
return another width;
}
}
Sprite에서 너비를 재정의하는 방법이 있습니까?x, y, 너비 및 높이 재정의 (getters)
내가 세터가 아니라 게터
을 무시하는 방법의 예 내가
override public function get width():Number {
if (onecase) {
return this width;
} else {
return another width;
}
}
예 당신이 할 수처럼 뭔가를 할 필요가 참조하십시오.
override public function get width():Number {
if (onecase) {
return myWidth;
} else {
return super.width;
}
}
super.width가 기본이됩니다. Sprite getter.
ActionScript 3.0에서 함수 오버로드를 지원하지 않으므로 setter/getter 메서드 서명이 동일해야합니다. 표시 객체의 x, y, width 및 height 속성은 int 객체가 아닌 Number 객체입니다.
//Class Properties
private var widthProperty:Number;
~
//Set Width
override public function set width(value:Number):void
{
widthProperty = value;
}
//Get Width
override public function get width():Number
{
return widthProperty;
}