Flex Panel Node Width 가져오기
이 문서는 Flex Panel Node의 너비 속성을 가져오는 함수에 대해 설명합니다. 이 함수는 주어진 Flex Panel Node의 너비를 반환합니다.
함수 설명
함수 이름
flexpanel_node_style_get_width
문법
flexpanel_node_style_get_width(node);
인자
인자 이름 | 타입 | 설명 |
---|---|---|
node | Flex Panel Node | 읽어올 노드 |
반환값
- Flex Panel Unit-Value Struct: 노드의 너비를 반환합니다.
예제
var _width = flexpanel_node_style_get_width(_node);
위 코드는 노드의 너비를 가져와서 지역 변수에 저장합니다.
활용 예제
예제 1: Flex Panel Node의 너비 출력하기
var _node = flexpanel_create();
var _width = flexpanel_node_style_get_width(_node);
show_message("노드의 너비는: " + string(_width));
예제 2: 조건에 따라 너비 조정하기
var _node = flexpanel_create();
var _width = flexpanel_node_style_get_width(_node);
if (_width < 100) {
flexpanel_node_style_set_width(_node, 100);
}
예제 3: 여러 노드의 너비 비교하기
var _node1 = flexpanel_create();
var _node2 = flexpanel_create();
var _width1 = flexpanel_node_style_get_width(_node1);
var _width2 = flexpanel_node_style_get_width(_node2);
if (_width1 > _width2) {
show_message("노드 1이 더 넓습니다.");
} else {
show_message("노드 2가 더 넓습니다.");
}
예제 4: 너비에 따라 색상 변경하기
var _node = flexpanel_create();
var _width = flexpanel_node_style_get_width(_node);
if (_width > 200) {
flexpanel_node_style_set_color(_node, c_green);
} else {
flexpanel_node_style_set_color(_node, c_red);
}
이 문서에서는 Flex Panel Node의 너비를 가져오는 방법과 다양한 활용 예제를 살펴보았습니다.