The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.38 / 5.00 36,385 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 13,902 ViewsWhat's wrong with this code? I don't know why it won't work.
stop();
plus_btn.addEventListener(MouseEvent.CLICK,plusClick);
sub_btn.addEventListener(MouseEvent.CLICK,subClick);
mult_btn.addEventListener(MouseEvent.CLICK,multClick);
div_btn.addEventListener(MouseEvent.CLICK,divClick);
eqls_btn.addEventListener(MouseEvent.CLICK.equalClick);
var plusSym:Boolean = false;
var subSym:Boolean = false;
var multSym:Boolean = false;
var divSym:Boolean = false;
num1.border=false;
num2.border=false;
num1.restrict = "0-9";
num2.restrict = "0-9";
function plusClick(event:MouseEvent):void{
plusSym = true;
subSym = false;
multSym = false;
divSym = false;
Sym_txt.text= "+";
}
function subClick(event:MouseEvent):void{
plusSym = false;
subSym = true;
multSym = false;
divSym = false;
sym_txt.text= "-";
}
function multClick(event:MouseEvent):void{
plusSym = false;
subSym = false;
multSym = true;
divSym = false;
sym_txt.text= "x";
}
function divClick(event:MouseEvent):void{
plusSym = false;
subSym = false;
multSym = false;
divSym = true;
sym_txt.text = "/";
}
//-----------------------Numbers------------------//
var input1:String;
var input2:String;
var plusRes:Number;
var subRes:Number;
var multRes:Number;
function equClick(event:MouseEvent):void{
input1 = num1.text;
input2 = num2.text;
if(plusSym == true){
plusRes = parselnt(input1) + parselnt(input2);
plusRes.toString()
results_txt.text = String(plusRes);
} else if(subSym == true){
subRes = parselnt(input1) - parselnt(input2);
subRes.toString()
results_txt.text = String(subRes);
} else if(multSym == true;){
multRes = parselnt(input1) * parselnt(input2);
multRes.toString()
results_txt.text = String(multRes);
} else if (divSym == true;) {
divRes = parselnt(input1) / parselnt(input2);
divRes.toString()
results_txt.text = String(divRes);
} else if {
results_txt.text = "Please choose and operator.";
}
} whats does the error thing say? could be that you forgot one more '}' at the end
At 5/15/09 11:33 PM, The-titan wrote: whats does the error thing say? could be that you forgot one more '}' at the end
This...
remove the ';' at the end of the statements so it would go like
} else if (multSym == true ){
i have the same AS [Fixed though, check it out as my first submission using BrainToast]
stop();
plus_btn.addEventListener(MouseEvent.CLICK,plusClick);
sub_btn.addEventListener(MouseEvent.CLICK,subClick);
mult_btn.addEventListener(MouseEvent.CLICK,multClick);
div_btn.addEventListener(MouseEvent.CLICK,divClick);
eqls_btn.addEventListener(MouseEvent.CLICK.equalClick);
var plusSym:Boolean = false;
var subSym:Boolean = false;
var multSym:Boolean = false;
var divSym:Boolean = false;
num1.border=false;
num2.border=false;
num1.restrict = "0-9";
num2.restrict = "0-9";
function plusClick(event:MouseEvent):void{
plusSym = true;
subSym = false;
multSym = false;
divSym = false;
Sym_txt.text= "+";
}
function subClick(event:MouseEvent):void{
plusSym = false;
subSym = true;
multSym = false;
divSym = false;
sym_txt.text= "-";
}
function multClick(event:MouseEvent):void{
plusSym = false;
subSym = false;
multSym = true;
divSym = false;
sym_txt.text= "x";
}
function divClick(event:MouseEvent):void{
plusSym = false;
subSym = false;
multSym = false;
divSym = true;
sym_txt.text = "/";
}
//-----------------------Numbers------------------//
var input1:String;
var input2:String;
var plusRes:Number;
var subRes:Number;
var multRes:Number;
function equClick(event:MouseEvent):void{
input1 = num1.text;
input2 = num2.text;
if(plusSym == true){
plusRes = parselnt(input1) + parselnt(input2);
plusRes.toString()
results_txt.text = String(plusRes);
} else if(subSym == true){
subRes = parselnt(input1) - parselnt(input2);
subRes.toString()
results_txt.text = String(subRes);
} else if(multSym == true){
multRes = parselnt(input1) * parselnt(input2);
multRes.toString()
results_txt.text = String(multRes);
} else if (divSym == true) {
divRes = parselnt(input1) / parselnt(input2);
divRes.toString()
results_txt.text = String(divRes);
} else if {
results_txt.text = "Please choose and operator.";
}
}
} 06-17-11: User of the Day
07-25-11: 1500th Post
08-09-11: Level 13!
At 5/15/09 11:38 PM, The-titan wrote: remove the ';' at the end of the statements so it would go like
} else if (multSym == true ){
That caused more errors...
i find it hard to help you this way, maybe upload the fla somewhere? ill have a look and fix it for you.
@U-Gamer
That didn't work either for some reason...
sent pm with fixed fla. Next time watch out for those silly spelling mistakes. c:
We didn't create new problems. The text and variables you're modifying are either non-existent or out of scope of your code.
At 5/15/09 11:43 PM, JollySpace wrote:At 5/15/09 11:38 PM, The-titan wrote: remove the ';' at the end of the statements so it would go likeThat caused more errors...
} else if (multSym == true ){