조건에 따라서 다른 실행이나 변수에 담는 여러가지 행위를 할 때 보통은 if를 사용하는 경우가 있습니다.
때에 따라서는 switch가 더 클린한 코드를 만들수 있습니다.

*if

if($condition){
	$res = 1;
}else{
	$res = 2;
}

*switch

switch($condition){
	case "1" : $res = "1"; breack;
	case "2" : $res = "2"; breack;
}

물론 if도 짧게 가능 합니다.

if($condition) $res = 1;
else $res = 2;

혹은 삼항 연산자도 가능합니다.

$res = ($condition) ? 1 : 2;



원문 출처 : http://stackoverflow.com/questions/2985921/what-if-stage-init-means-in-actionscript

actually means that if stage != null, run initialization. 라고 합니다.

만약 스테이지가 널이 아니라면 initialization 실행.

'tech > FLASH' 카테고리의 다른 글

1180:call to a possibly undefined method addChild.  (0) 2010.12.07
flash oop 구조 정리 잘 된 곳~  (0) 2010.12.03
xml loading  (0) 2008.09.23
rewind  (0) 2008.09.23
html과 연계하지 않은 flash 만의 새 창 띄우기  (0) 2008.09.23

+ Recent posts