Skip to main content
Inspiring
September 17, 2013
Answered

[i]._visible

  • September 17, 2013
  • 1 reply
  • 1220 views

Below is my code. This dosen't seem to work even though capts are all fasle. Where's the fault?

var capts:Array = [purchaseH0, purchaseH1, purchaseH2, purchaseH3];

for(i=0; i<capts.length; i++){

          _root["purchaseH"+i]._visible=false;

          nextStep_btn.onRelease = function () {

                    if(capts._visible==false){

                              trace("invisible")

                    } else {

                              trace ("visible")

                    }

                    }

}

};

This topic has been closed for replies.
Correct answer kglad

i still don't know what you're trying to do but the additional for-loop i mentioned above should be inside, the onRelease:

          nextStep_btn.onRelease = function () {

               for(i=0; i<capts.length; i++){

                    if(capts._visible==false){

                              trace("invisible")

                    } else {

                              trace ("visible")

                    }

              }

};

1 reply

kglad
Community Expert
Community Expert
September 17, 2013

i=capts.length when that button is clicked.

what are you trying to do when that button is clicked.  if you want to loop through capts, you'll need another for-loop.

Inspiring
September 17, 2013

Thanks for the reply kglad.

I used another for loop. But still the output is "visible".

Also either it's  if(capts._visible==false){  or if(capts._visible==true){ the output is still 'visible'?

var capts:Array = [purchaseH0, purchaseH1, purchaseH2, purchaseH3];

for(i=0; i<capts.length; i++){

          _root["purchaseH"+i]._visible=false;

}

for(i=0; i<capts.length; i++){

          nextStep_btn.onRelease = function () {

                    if(capts._visible==false){

                              trace("invisible")

                    } else {

                              trace ("visible")

                    }

                    }

};

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 17, 2013

i still don't know what you're trying to do but the additional for-loop i mentioned above should be inside, the onRelease:

          nextStep_btn.onRelease = function () {

               for(i=0; i<capts.length; i++){

                    if(capts._visible==false){

                              trace("invisible")

                    } else {

                              trace ("visible")

                    }

              }

};