i trying make app students solve simple equations. want them able input necessary parts of equation able touch button reveal each of next steps like. design terrible right now, i'm trying functioning worry how looks later. moving along nicely have hit snag. works through first step. however, once add stuff performsecondstep function, can't enter text text boxes @ begginning anymore. i'm not sure of problem. post code when works , when won't let me input text anymore.
works fine,
import flash.text.textfieldtype;
onestepbtn.addeventlistener(mouseevent.click, setonestep);
twostepbtn.addeventlistener(mouseevent.click, settwostep);
firststepbtn.addeventlistener(mouseevent.click, performfirststep);
var operator:string = new string;
var constant1:int = new int;
var answer:int = new int;
operator11.visible = false;
constantused1.visible = false;
constantused2.visible = false;
secondstepbtn.visible = false;
operator12.visible = false;
answeroutput.visible = false;
var constantinputtext:string = new string;
var answerinputtext:string = new string;
var operatorinputtext:string = new string;
operatorinput.restrict = "+\\-";
function setonestep(e:mouseevent):void {
}
function settwostep(e:mouseevent):void {
}
function performfirststep(e:mouseevent):void {
constantinputtext = constantinput.text;
answerinputtext = answerinput.text;
operatorinputtext = operatorinput.text;
operator11.visible = true;
operator12.visible = true;
constantused1.visible = true;
constantused2.visible = true;
secondstepbtn.visible = true;
if (operatorinput.text == "+") {
operator11.text = "-";
operator12.text = "-";
} else {
operator11.text = "+";
operator12.text = "+";
}
constant1 = int(constantinputtext);
answer = int(answerinputtext);
constantused1.text = constantinputtext;
constantused2.text = constantinputtext;
firststepbtn.removeeventlistener(mouseevent.click, performfirststep);
operatorinput.type = textfieldtype.dynamic;
constantinput.type = textfieldtype.dynamic;
answerinput.type = textfieldtype.dynamic;
secondstepbtn.addeventlistener(mouseevent.click, performsecondstep);
}
function performsecondstep(e:mouseevent):void {
answeroutput.visible = true;
answeroutput.text = "hello";
}
this has dummy code performsecondstep function. when put stuff in function, lose ability input text @ beginning of program. not sure why.
import flash.text.textfieldtype;
onestepbtn.addeventlistener(mouseevent.click, setonestep);
twostepbtn.addeventlistener(mouseevent.click, settwostep);
firststepbtn.addeventlistener(mouseevent.click, performfirststep);
var operator:string = new string;
var constant1:int = new int;
var answer:int = new int;
operator11.visible = false;
constantused1.visible = false;
constantused2.visible = false;
secondstepbtn.visible = false;
operator12.visible = false;
answeroutput.visible = false;
step2x.visible = false;
step2equals.visible = false;
var constantinputtext:string = new string;
var answerinputtext:string = new string;
var operatorinputtext:string = new string;
var isplus:boolean = new boolean;
isplus = true;
operatorinput.restrict = "+\\-";
function setonestep(e:mouseevent):void {
}
function settwostep(e:mouseevent):void {
}
function performfirststep(e:mouseevent):void {
constantinputtext = constantinput.text;
answerinputtext = answerinput.text;
operatorinputtext = operatorinput.text;
operator11.visible = true;
operator12.visible = true;
constantused1.visible = true;
constantused2.visible = true;
secondstepbtn.visible = true;
if (operatorinput.text == "+") {
operator11.text = "-";
operator12.text = "-";
} else {
operator11.text = "+";
operator12.text = "+";
isplus = false;
}
constant1 = int(constantinputtext);
answer = int(answerinputtext);
constantused1.text = constantinputtext;
constantused2.text = constantinputtext;
firststepbtn.removeeventlistener(mouseevent.click, performfirststep);
operatorinput.type = textfieldtype.dynamic;
constantinput.type = textfieldtype.dynamic;
answerinput.type = textfieldtype.dynamic;
secondstepbtn.addeventlistener(mouseevent.click, performsecondstep);
}
function performsecondstep(e:mouseevent):void {
answeroutput.visible = true;
if (isplus ==true) {
answeroutput.text = string(answer - constant1);
} else {
answeroutput.text = string(answer + constant1);
}
}
any appreciated.
thank you,
jeremy
if not showing code ends causing problem, there not can help. familiar using trace() function track down problems code? error messages when find program failing?
More discussions in ActionScript 3
adobe
Comments
Post a Comment