# Simple, but why not!

**URL:** <https://forum.kirupa.com/t/simple-but-why-not/182773>\
**Category:** flash\
**Created:** [March 21, 2006, 11:29am UTC](https://forum.kirupa.com/t/simple-but-why-not/182773 "2006-03-21T11:29:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jt\_01](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jt\_01](https://forum.kirupa.com/u/Jt_01)\
**Post date:** [March 21, 2006, 11:29am UTC](https://forum.kirupa.com/t/simple-but-why-not/182773/1 "2006-03-21T11:29:34Z")

</div>

Why doesn’t this work:

```auto
function checksize() {
    loadMovie(imagePath, targetx.holder);
    targety = "_root.topclip1"
    _root.targety.movie.gotoAndPlay("in");        
};

```

But then this will?

```auto
function checksize() {
    loadMovie(imagePath, targetx.holder);
    _root.topclip1.movie.gotoAndPlay("in");        
};

```

---

<div class="post-metadata">

**Author:** ![kookaburra](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kookaburra](https://forum.kirupa.com/u/kookaburra)\
**Post date:** [March 21, 2006, 11:32am UTC](https://forum.kirupa.com/t/simple-but-why-not/182773/2 "2006-03-21T11:32:38Z")

</div>

> [@Jt\_01](#):
>
> Why doesn’t this work:
> 
> ```auto
> function checksize() {
> loadMovie(imagePath, targetx.holder);
> targety = "_root.topclip1"
> _root.targety.movie.gotoAndPlay("in");        
> };
> 
> ```
> 
> But then this will?
> 
> ```auto
> function checksize() {
> loadMovie(imagePath, targetx.holder);
> _root.topclip1.movie.gotoAndPlay("in");        
> };
> 
> ```

write targety = eval(“\_root.topclip1”)  
or targety = \_root[topclip1]

---

<div class="post-metadata">

**Author:** ![Jt\_01](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jt\_01](https://forum.kirupa.com/u/Jt_01)\
**Post date:** [March 21, 2006, 11:35am UTC](https://forum.kirupa.com/t/simple-but-why-not/182773/3 "2006-03-21T11:35:44Z")

</div>

Great! Thanks, But can you explain how does that work?

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [March 21, 2006, 1:04pm UTC](https://forum.kirupa.com/t/simple-but-why-not/182773/4 "2006-03-21T13:04:43Z")

</div>

If you want to access an object, you need to somehow target him with a path.  
In your sample, targety is defined as a string. You cant access and instance of an object with string, unless you dont use associative arrays (\_root[“something”] means movieclip or variable in root).

btw.

```auto
function checksize() {
    loadMovie(imagePath, targetx.holder);
    targety = _root.topclip1;
    _root.targety.movie.gotoAndPlay("in");        
};

```

would also work because you dont store a string in targety, but actualy a refference to an instance of topclip1 movieclip.
