2014-11-12 3 views
0

1 프레임에서 2 무비 클립을 변경하려고합니다. 첫 번째 무비 클립은 앱이 시작될 때 소개 용이며 두 번째 무비 클립이 계속됩니다. 여기 내 코드 :movieclip as3을 변경하는 방법

var sunR1:classSunRays1; //movieclip export 
var sunR2:classSunRays2; //movieclip export 

function intro():void{ 

      sunR1 = new clsSunRays1(); 
      sunR1.x = mapW/2; 
      sunR1.y = mapH/2; 
      sunR1.width += 200; 
      sunR1.height += 200; 
      stage.addChild(sunR1); 
      if (sunR1.currentFrame == sunR1.totalFrames){ 
       stage.removeChild(sunR1); 
       sunR2 = new clsSunRays2(); 
       sunR2.x = mapW/2; 
       sunR2.y = mapH/2; 
       sunR1.width += 200; 
       sunR1.height += 200; 
       stage.addChild(sunR2); 
      } 
     } 

답변

0

당신은 같은 것을 시도 할 수 있습니다 :

function intro():void 
{ 
    sunR1 = new classSunRays1(); 
    sunR1.stop(); 
    sunR1.x = mapW/2; 
    sunR1.y = mapH/2; 
    sunR1.width += 200; 
    sunR1.height += 200; 
    stage.addChild(sunR1); 
    // adding a function to be called in the last frame (when you will apply your logic) 
    sunR1.addFrameScript(sunR1.totalFrames -1, changeMovieClip); 
    sunR1.play(); 
} 

function changeMovieClip():void 
{ 
    sunR1.stop(); 
    stage.removeChild(sunR1); 
    sunR2 = new classSunRays2(); 
    sunR2.stop(); 
    sunR2.x = mapW/2; 
    sunR2.y = mapH/2; 
    sunR2.width += 200; 
    sunR2.height += 200; 
    stage.addChild(sunR2); 
    sunR2.play(); 
} 
+0

가 대단히 감사는 아주 잘 작동 –

+0

당신은 환영합니다! – gabriel

관련 문제