# Watching variable in array

**URL:** <https://forum.kirupa.com/t/watching-variable-in-array/112371>\
**Category:** Uncategorized\
**Created:** [June 7, 2004, 1:10am UTC](https://forum.kirupa.com/t/watching-variable-in-array/112371 "2004-06-07T01:10:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![d2kagw](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/d2kagw/32/539_2.png) [@d2kagw](https://forum.kirupa.com/u/d2kagw)\
**Post date:** [June 7, 2004, 1:10am UTC](https://forum.kirupa.com/t/watching-variable-in-array/112371/1 "2004-06-07T01:10:06Z")

</div>

Hi Everyone,

quick question about the this.watch(“variable”, function, args)  
tag, does anyone know how to get this to watch a variable within an array or object, for example : i have an array

```auto
myArray = new Array('jello', 'pizza', 'pie', 'coke')

```

then I have a MC with the code:

```auto
_root.watch("myArray[1]", traceMe)
//
function traceMe(a,b,c)
{
    trace(c)
    trace(_root.myArray[1])
}

```

So, whenever I change the data in Array[1] I want the MC to trace the result…can this be done?

Also, does anyone know any reason why I shouldn’t use the Watch tag?  
I haven’t seen it used much before, but I really like it, so I was kinda wondering if there was any reason why it is rarely used…

thanks in Advance C:-)
