Sorry - should have said - AS2
I'm sorry to post again on the same subject but the reply I got didn't help me and I am stuck.
I am trying to track the number of correct hits to navigate forward from a drag and drop game but it doesn't work.
I was told that it's because I need to increment the value of hitsNum after every stop drag but I thought I was doing that with hitsNum++;. The hits count up and display in the text but the gotoAndPlay doesn't work.
I am a beginner so please, if you are kind enough to reply, can you spell out for me what I need to do?
Thanks so much for your time.
fla file attached
Code:
var hits: Number = 0;
var hitsNum:Number = 1;
function updateHits(){
hitsTxt.text = hits;
//commented out things I have tried to get the increment to work
mc.onRelease = function(){
if (this.hitTest(target_mc))
//hits += hitsNum;
hits++;
updateHits();
mc._x = targetmc._x;
mc._y = targetmc._y;
//hits = hits + 1;
stopDrag();
//hitsNum += 1;
//hitsNum++;
//Various things I've tried for the gotoandPlay
if (hitsNum==5) {
this._parent.gotoAndPlay("end_page");
}
if (hits==5) {
gotoAndPlay("end_page");
}
if (hits>=5) {
this._parent.gotoAndPlay("end_page");
}