2014-03-19 6 views
0

안녕하세요, 내 actionscript3 코드 while 루프에 의해 계산 된 모든 라인을 표시하는 능력 계산기를 만들려고 해요. 프로그램을 실행할 때 플래시 파일은 마지막 루프 만 표시합니다. 누군가 트레이스를 사용하지 않고 작업하게 만들 수 있습니까? 플래시 프로그램에 표시해야합니다. 여기 내 코드입니다 :Actionscript While loop & addChild problems

private function evalue(event:MouseEvent = null):void 
{ 
maMiseEnForme.font="Arial"; 
maMiseEnForme.size=14; 
maMiseEnForme.bold=true; 
maMiseEnForme.color=0x000000; 
monMessage.x=270; 
monMessage.y=375; 

monMessage.autoSize=TextFieldAutoSiz... 
monMessage.border=true; 
monMessage.defaultTextFormat=maMiseE... 

var base:uint; 
var reponse:uint; 
var puissanceCount:int=1; 
var puissance:uint; 
var reponseText:String; 


base = uint(boiteBase.text); 
puissance = uint(boitePuissance.text); 
while (puissanceCount <= puissance) 
{ 
reponse = Math.pow(base,puissanceCount); 
reponseText=(base + "^" + puissanceCount + "=" + reponse + "\n"); 
monMessage.text=reponseText; 
addChild(monMessage); 
puissanceCount++ 
} 
} 
} 
} 

나는 .SWF 창에 표시되는 내용의 사진을 첨부 :

P.S : 내가 깜박 초보자입니다.

미리 감사드립니다.

답변

0

"="매개 변수 대신 "+ ="매개 변수를 사용하여 "매번 새로 고침"대신 "문자열 추가"로 문자열 변수를 업데이트 한 다음 while 루프가 끝난 후에 텍스트를 표시 할 수 있습니다. everyloop에 child (nonMessage)를 추가 할 필요가 없습니다. while{} 루프 이후에 이동하십시오. 그래서 : "monMessage.text=reponseText;"대신 "monMessage.text+=reponseText;"이 필요하고 "addChild()"을 while 루프 옆으로 옮기십시오.