>>>ex
ham_mc.addEventListener(MouseEvent.MOUSE_DOWN, onStart);
potato_mc.addEventListener(MouseEvent.MOUSE_DOWN, onStart);
coca_mc.addEventListener(MouseEvent.MOUSE_DOWN, onStart);
function onStart(e:MouseEvent):void{
//e.currentTarget 과같음
var mc:MovieClip = e.currentTarget as MovieClip;
mc.startDrag(false);
//스테이지에 선택한 mc를 갖다붙임.결국 맨위로올라옴
this.addChild(mc);
}
ham_mc.addEventListener(MouseEvent.MOUSE_UP, onStop);
potato_mc.addEventListener(MouseEvent.MOUSE_UP, onStop);
coca_mc.addEventListener(MouseEvent.MOUSE_UP, onStop);
function onStop(e:MouseEvent):void{
var mc2:MovieClip = e.currentTarget as MovieClip;
mc2.stopDrag();
}
4강. hitTest (0) | 2010.12.27 |
---|---|
4강. 괄호연산자 표기법 (0) | 2010.12.27 |
3강. startDrag, stopDrag (0) | 2010.12.27 |
3강. 동일한 Event 적용시, 함수 축약하기 (0) | 2010.12.27 |
3강. ENTER_FRAME, hasEventListener, removeEventListener (0) | 2010.12.27 |