-
1. Re: [i]._visible
kglad Sep 17, 2013 8:32 AM (in response to Ron Colmen)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.
-
2. Re: [i]._visible
Ron Colmen Sep 17, 2013 9:21 AM (in response to kglad)Thanks for the reply kglad.
I used another for loop. But still the output is "visible".
Also either it's if(capts[i]._visible==false){ or if(capts[i]._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[i]._visible==false){
trace("invisible")
} else {
trace ("visible")
}
}
};
-
3. Re: [i]._visible
kglad Sep 17, 2013 1:39 PM (in response to Ron Colmen)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[i]._visible==false){
trace("invisible")
} else {
trace ("visible")
}
}
};
-
4. Re: [i]._visible
Ron Colmen Sep 17, 2013 2:13 PM (in response to kglad)Thanks Kglad. That worked. But I don't quite understand why does it make a difference when the for-loop is inside or outside the onRelease??
p.s.I'm using this to check if all mcs in capts is visible=false.
-
5. Re: [i]._visible
kglad Sep 17, 2013 6:56 PM (in response to Ron Colmen)this code:
for(i=0; i<capts.length; i++){
nextStep_btn.onRelease = function () {
if(capts[i]._visible==false){
trace("invisible")
} else {
trace ("visible")
}
}
};
creates capts.length number of identical onRelease handlers. in as2, only the last one is implemented. it overrides the earlier ones, but you can't tell because all of them are identical.
anyway, when you release nextStep_btn, i is equal to capts.length and there is no capts[i] object so that if-statement makes no sense to flash. ie, that block of code makes no sense to flash.
-
6. Re: [i]._visible
Ron Colmen Sep 17, 2013 10:38 PM (in response to kglad)Thanks. That makes sense.
-



