all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

help with variable


help with variable klintonray
3/3/2005 10:56:03 PM
flash actionscript:
i am new to actionscript and cannot figure out a problem. I would like to hide
the visibility of 6 text input components via a loop statement. I cannot
figure out why it is not working. this is the statement that does not work.

for(var i:Number = 1; i<7; i++){
this.inputScreen.submitFindAreaMC.shotDescriptionInput.visible = false;
}


this statement does work

for(var i:Number = 1; i<7; i++){
this.inputScreen.submitFindAreaMC.shotDescriptionInput[1].visible = false;
}

I guess I could just type out each component by putting ....[2] ... and so on,
but I would like to figure out how to make it work using the variable i in the
loop statement.
Re: help with variable kglad
3/4/2005 6:10:43 AM
i don't know why either of them would work because there's no visible property.
you need to use the _visible property

for(var ivar:Number = 1; ivar<7; ivar++){
this.inputScreen.submitFindAreaMC.shotDescriptionInput[ivar]._visible = false;
}
Re: help with variable klintonray
3/4/2005 3:32:41 PM
thanks for the reply kglad! I can't seem to get the code that you wrote to
work either. -->

for(var ivar:Number = 1; ivar<7; ivar++){
this.inputScreen.submitFindAreaMC.shotDescriptionInput[ivar]._visible = false;
}

in that area, I have 6 input text components called shotDescriptionInput1,
shotDescriptionInput2, shotDescriptionInput3, etc...

The only thing that seems to work is if I manually type
this.inputScreen.submitFindAreaMC.shotDescriptionInput1._visible = false;

I have no idea why it won't let me plug in the [vari] after
shotDescriptionInput !
Re: help with variable kglad
3/4/2005 3:39:19 PM
oh, in that case:

for(var ivar:Number = 1; ivar<7; ivar++){
this.inputScreen.submitFindAreaMC["shotDescriptionInput"+ivar]._visible = false;
Re: help with variable klintonray
3/4/2005 4:02:14 PM
AddThis Social Bookmark Button