더 정확하게 말하면, 컨트롤의 상단과 자식의 상단 사이의 거리를 얻고 싶습니다 (그리고 모두의 높이 멤버를 추가하는 것). 위의 아이들은 특별한 결과를 산출합니다!)하지만 절대 좌표를 얻고 비교하는 과정이 엉망입니다.플렉스 : 컨트롤 모음의 높이를 가져 오는 것
나는이 개 태그의 꼭대기 사이의 높이를 계산하기 위해이 기능을 사용
private static function GetRemainingHeight(oParent:Container, oChild:Container,
yParent:Number, yChild:Number):Number {
const ptParent:Point = oParent.localToGlobal(new Point(0, yParent));
const ptChild:Point = oChild.localToGlobal(new Point(0, yChild));
const nHeightOfEverythingAbove:Number = ptChild.y - ptParent.y;
trace(ptChild.y.toString() + '[' + yChild.toString() + '] - ' +
ptParent.y.toString() + '[' + yParent.toString() + '] = ' + nHeightOfEverythingAbove.toString() + ' > ' + oParent.height.toString());
return nHeightOfEverythingAbove;
}
주 oParent.y == yParent
그와 oChild.y == yChild
하지만 난 그것을 이유를 바인딩이 방법을했다. 내가 할 결과는 매우 놀라운 일이다 :
822 [329] - (124) [0] = 698>
oChild
의 상단이oParent
아래 사라지지 않기 때문에 불가능하다 439
. 예기치 않은 유일한 인물은 ptChild.y입니다. 다른 모든 숫자는 꽤 제정신입니다. 그래서 나는 내 실수가 비교할 수없는 두 가지 수치를 뺀 것으로 가정하고 있습니다.
물론 누구나 localToGlobal()
이 포함되지 않은 두 점의 차이를 계산하는 방법이 있다면 그 점도 좋습니다.
3.5 SDK를 사용하고 있습니다.