플래쉬 초보인데요

 

어디서 프리소스를 하나 찾아서 공부중인데요

 

상품 진열식의 소스 입니다

가만히 놔두면 정상적으로 왼쪽으로 갔다가 그림이 끝나면 다시 오른쪽으로 갑니다

 

하지만 문제는 위에 prev버튼이나 nex 버튼을 눌러서 \"가만히 나둘경우\"

 

무한 루트를 돌게 됩니다.. 다시 오른쪽이나 왼쪽으로 갈 생각을 안하고

 

그냥 쭉~ 갑니다-_-

아래는 엑션 소스구요

//크기고정
//Stage.scaleMode = \"noscale\";
// 초기화
function init() {
 // 이미지의 총갯수
 img_num = 7;
 // 이미지의 width를 변수로 저장
 img_width = _root.img.img1._width;
 // 초기 img무비클립의 x좌표값을 저장
 img_x = img._x;
 //증가되는 값 초기화
 _root.increase_num = 0;
 //
 _root.img.k = 0;
 // 초기 타겟 지점을 img무비클립과 같은 위치로 잡음
 _root.targetx = _root.img._x;
 //부드러운 움직임의 속력 변수
 _root.img.speed = 0.5;
 // 이미지들을 나열함
 for (var i = 1; i<=img_num; i++) {
  _root.img[\"img\"+i]._x = (i-1)*img_width;
 }
 //한계 벽을 나타내는 변수
 _root.wall = false;
 //방향 전환을 위한 변수
 _root.speed = 1;
}
//최초 한번 실행
init();

// 이미지 사진에 마스크를 씌움
 _root.img.setMask(\"_root.mask\");
 
// 부드러운 움직임
MovieClip.prototype.smoothMove = function(speed, targetx) {
 this._x += speed*(targetx-this._x);
};
_root.onEnterFrame = function() {
 //증가값
 _root.increase_num += 1;
 //조건을 만족하면 실행
 if (_root.increase_num == 30) {
  //오른쪽 한계까지 가면 반응
  if (_root.img.k == 4 and _root.wall == false) {
   _root.speed = -1 
   _root.wall = true;
  }
  //왼쪽 한계까지 가면 반응
  if (_root.img.k == 0 and _root.wall == true) {
   _root.speed = 1; 
   _root.wall = false;
  }
  _root.img.k += 1*_root.speed;
  //부드러운 움직임의 타겟좌표 설정
  targetx = img_x-(img_width*_root.img.k);
  _root.increase_num = 0;
 
 }
};

_root.img.onEnterFrame = function() {
 //img무비클립의 부드러운 움직임
 this.smoothMove(this.speed, _root.targetx);
};
 
//앞으로 가기 버튼
_root.BnNext.onRelease = function() {
 if (_root.img.k < 4) {
  _root.speed = 1;   
  _root.increase_num = 0
  _root.img.k += 1*speed;
  targetx = img_x-(img_width*_root.img.k);
 } else {
  _root.speed = -1;
 }
};
//뒤로 가기 버튼
_root.BnPrev.onRelease = function() {
 if (_root.img.k > 0) {
  _root.speed = -1;   
  _root.increase_num = 0
  _root.img.k += 1*speed;
  targetx = img_x-(img_width*_root.img.k);
 } else {
  _root.speed = 1;
 }
};





공부중인데답답해서 질문드려요

소스는 공개용이라 올려봅니다 보시구 해결좀 ㅠ_ㅠ