2012-02-29 3 views
0

함수의 매개 변수로 gotoAndStop ('label') 내의 프레임 레이블을 변경할 수 있습니까?프레임 레이블 및 함수 매개 변수

내가 더 많은 기술을 배울으로 코드를 업데이트하는 장난 해요, 그리고 순간에 코드가 객체의 모양을 선택하는 기본 클릭-A-버튼, 그리고 눌러에 버튼이 사라집니다 :

// Change the object into a circle. 
circle_btn.addEventListener(MouseEvent.CLICK,function(){changeShape_fun(circle_btn,circle);}); 

// Change the object into a square. 
square_btn.addEventListener(MouseEvent.CLICK,function(){changeShape_fun(square_btn,square);}); 

// Change the object into a star. 
star_btn.addEventListener(MouseEvent.CLICK,function(){changeShape_fun(star_btn,star);}); 

function changeShape_fun(shape_btn,frame){ 
shape_btn.visible = false; 
main_mc.gotoAndStop('frame'); 
} 

그러나 함수 매개 변수를 통해 프레임 레이블을 변경하는 방법을 알지 못하거나 내가하려고하는 것이 가능할 수도 없습니다.

나는 또한 내가하고 싶은 일을하는보다 효율적인 방법에 대해 모두 귀하고 있지만, 나는 당신이 함수 파 미터를 통해 프레임 레이블을 어떻게 바꿀 수 있는지 알고 싶다.

감사합니다. :)

답변

0

당신은 매우 가깝지만, 프레임 프레임에 포함 된 문자열이 아닌 '프레임'이라는 프레임으로 이동하려고합니다. 대신보십시오 : 당신이 사각형을 클릭하면 당신이 원 또는 '광장'을 클릭하면

// Change the object into a circle. 
circle_btn.addEventListener(MouseEvent.CLICK,function(event:MouseEvent){changeShape_fun(circle_btn, 'circle');}); 

// Change the object into a square. 
square_btn.addEventListener(MouseEvent.CLICK,function(event:MouseEvent){changeShape_fun(square_btn, 'square');}); 

// Change the object into a star. 
star_btn.addEventListener(MouseEvent.CLICK,function(event:MouseEvent){changeShape_fun(star_btn, 'star');}); 

function changeShape_fun(shape_btn,frame){ 
    shape_btn.visible = false; 
    main_mc.gotoAndStop(frame); 
} 

이는 '원'이라는 main_mc 내에서 프레임으로 이동합니다 등