2011-04-13 2 views
1

홈페이지에 10 개의 버튼이 있으며 버튼을 클릭 할 때 동일한 무비 클립을 재생하고 각기 다른 버튼에 대한 특정 프레임으로 이동하려고합니다. .플래시 : 동영상 클립을 재생 한 다음 각 버튼마다 다른 프레임으로 이동합니다.

무비 클립의 끝 부분에서 동작을 변경하기 위해 10 개의 다른 무비 클립을 만들지 않고도 쉽게 만들 수 있다는 것을 알고 있습니까?

이 그것을하고 상당히 쉬운 방법 당신

답변

1

감사 : 스크립트가 실행 할 때 버튼을 타임 라인에 존재해야합니다.

button1.addEventListener(MouseEvent.CLICK, onClickHandler); 
button2.addEventListener(MouseEvent.CLICK, onClickHandler); 
button3.addEventListener(MouseEvent.CLICK, onClickHandler); 

private function onClickHandler(event : MouseEvent) : void 
{ 
    switch(event.target) 
    { 
     case button1: 
      // code to execute when button 1 is clicked 
      gotoAndPlay(50); 
      break; 

     case button2: 
      // code to execute when button 2 is clicked 
      gotoAndPlay(100); 
      break; 

     case button3: 
      // code to execute when button 3 is clicked 
      gotoAndPlay(150); 
      break; 
    } 
} 
관련 문제