Hi,
I’m new to AS3, but have written a piece of code in AS2 which I’m now trying to convert.
Basically I’ve got a movieclip (“grid1”) and in that there are a number of instances of the same movieclip (“g1”, “g2” etc) and in that is a textbox (“ans.text”). The code I worte passes the name of the movieclip click and takes the content of that textbox and passes it to a function which checks it.
on the button:
on (press){
checkAns1p(this.ans.text, this);
}
the function:
function checkAns1p(myAns, referer) {
if (myAns == sub_answer) {
//do something
}
This works fine, the problem I am finding is now that AS3 does not use “on (press)” I don’t see how it’s possible to pass this information.
function checkAns(event:MouseEvent):void {
selectedAns = grid1.g1.ans.text;
if (selectedAns == subAns){
trace("Correct!");
}
}
If I hard code it as above then it works, but I don’t want to have to do this 32 times. Is there anyway to pass “this” across as I did in AS2?