Calculate the power
HI there, this is my program. I'm trying to calculate the power of a number entered first but when i click on the button, nothing happens.
Helps pls.
Tks a lot.
package
{
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class U1A7_Puissances extends MovieClip
{
public var entierBase:TextField;
public var entierExposant:TextField;
public var btnCalculer:SimpleButton;
private var maMiseEnForme:TextFormat=new TextFormat();
private var afficheReponse:TextField=new TextField();
public function U1A7_Puissances()
{
this.btnCalculer.addEventListener(MouseEvent.CLICK, this.calculPuissance);
}
private function calculPuissance(event:MouseEvent):void
{
var intBase:int = 0;
var intExposant:int = 0;
var nouvMessage:String= "";
var i:int=0;
intBase = int(this.entierBase.text);
intExposant = int(this.entierExposant.text);
while (i++ < intExposant)
{
nouvMessage=(nouvMessage + intBase + " exposant " + i + " = " + Math.pow(intBase,i) + "\n");
}
maMiseEnForme.font="Arial";
maMiseEnForme.size=20;
maMiseEnForme.color=0x0000FF;
afficheReponse.defaultTextFormat=maMiseEnForme;
afficheReponse.x=50;
afficheReponse.y=50;
afficheReponse.border=true;
afficheReponse.borderColor=0x000000;
afficheReponse.autoSize=TextFieldAutoSize.LEFT;
afficheReponse.text = nouvMessage ;
addChild(maReponse);
}
}
}
