노란날. 2010. 12. 27. 00:51
반응형


>>>갤러리1 ex

 

 

next_btn.addEventListener(MouseEvent.CLICK, onNext);
function onNext(e:MouseEvent):void{
//만약 pic_mc 의 현재 프레임위치가 4라면

 if(pic_mc.currentFrame == 4){
// 1프레임위치에 가서 멈춰라 

 pic_mc.gotoAndStop(1);
 }else{
//아닐시에는 다음프레임으로 넘어감

 pic_mc.nextFrame();
 }
}


prev_btn.addEventListener(MouseEvent.CLICK, onPrev);
function onPrev(e:MouseEvent):void{
 if(pic_mc.currentFrame == 1){
  pic_mc.gotoAndStop(4);
 }else{
 pic_mc.prevFrame();
 }
}

 

 

>>>갤러리2 ex

 

 

next_btn.addEventListener(MouseEvent.CLICK, onNext);
function onNext(e:MouseEvent):void {
// totalFrames 는 무비클립에 있는 총 프레임수(프레임이 추가되거나, 프레임을 직접 세는 수고를 덜수있다) 

 if (pic_mc.currentFrame == pic_mc.totalFrames) {
  pic_mc.gotoAndStop(1);
 } else {
  pic_mc.nextFrame();
 }
}

prev_btn.addEventListener(MouseEvent.CLICK, onPrev);
function onPrev(e:MouseEvent):void {
 if (pic_mc.currentFrame == 1) {
  pic_mc.gotoAndStop(pic_mc.totalFrames);
 } else {
  pic_mc.prevFrame();
 }
}

반응형