# How to write variable so that it target another variable?

**URL:** <https://forum.kirupa.com/t/how-to-write-variable-so-that-it-target-another-variable/330249>\
**Category:** flash\
**Created:** [December 19, 2012, 7:29am UTC](https://forum.kirupa.com/t/how-to-write-variable-so-that-it-target-another-variable/330249 "2012-12-19T07:29:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickyls](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rickyls](https://forum.kirupa.com/u/rickyls)\
**Post date:** [December 19, 2012, 7:29am UTC](https://forum.kirupa.com/t/how-to-write-variable-so-that-it-target-another-variable/330249/1 "2012-12-19T07:29:01Z")

</div>

say i have this code:  
var mons001hp:Number=500;  
var mons001str:Number=10;  
var mons002hp:Number=100;  
var mons002str:Number=20;  
var currentmons:String=“mons001”;  
function currentmonsterrule(){  
currentmons1hp=currentmons(which is mons001)+hp;//so that it will be read as mons001hp as variable not word like “mons001hp”  
currentmons1str=currentmons+str;  
}  
//so i want it that if currentmons is mons001 the currentmons1hp will be mons001hp and same for str and if i change the currentmons to “mons002” the value of currentmons1hp and str will be mons002hp and str, and same for mons003,004,005~  
but how do i write it?  
i using adobe flash cs4 action script 2.0
