Skip to main content
Participant
February 19, 2013
Question

i want to change the value of a text and this text is called by another text value..

  • February 19, 2013
  • 1 reply
  • 856 views

i have a txt_blk1 up to txt_blk32 and i also have a txt_we  .. if the text_we.text has a value of 1 to 32  how can i change the value of txt_block0-32.text to 0.. the text we already generates its own value so i dont have to use for loop.  i've tried to use  _root["txt_blk"+txt_we.text] = 0; im using actionscript 2 .. can someone help me

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
February 19, 2013

If txt_blk#'s are also textfields, then you need to assign the 0 to the text property...

_root["txt_blk"+txt_we.text].text = 0;

If they are variables then that line should work.

If it still fails, try tracing the number of characters in the text_we textfield.  If it happens to have more than you expect, it might be defined as a multiline textfield where it needs to be a single line

If that code is on the root timeline I recommend using "this" instead of "_root".  Unnecessary use of _root is best avoided.

emillimeAuthor
Participant
February 19, 2013

the textfield wont still change to zero.. but thank you sir it means a lot.. the txt_blk1-32 change its value when a hittest run on a mc_chip ive made. i have 24 chips and if the chip somehow collide with the block then it will change depending on what chip is moved but doesnt change the value to 0 when it leaves a block .. im making a board game similar to checkers. just sharing what i'm going through right now.. again sir thank you

Ned Murphy
Legend
February 19, 2013

You should show the code that is related to the problem you are haviing.  It does not appear trhe one line of code is where the problem lies.  I see you started another posting, so if you are pursuing this further in that posting I will stop trying to help here.