# Functions path

**URL:** <https://forum.kirupa.com/t/functions-path/118205>\
**Category:** Uncategorized\
**Created:** [August 3, 2004, 4:07pm UTC](https://forum.kirupa.com/t/functions-path/118205 "2004-08-03T16:07:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 3, 2004, 4:07pm UTC](https://forum.kirupa.com/t/functions-path/118205/1 "2004-08-03T16:07:17Z")

</div>

Hey,  
I am kinda puzzled as to where functions lay in path targeting. for example, lets day i have this code on the first frame of a blank .fla:

```auto

function pathTest() {
trace("it runs...")
this.atextfield.text="test..."
}
pathTest()

```

and then of course on the stage i have a text field with a instance named atextfield. the function runs but does not work. If i take off the “this” then it works. Why? I was reading something about private and public functions the other day, does this have anything to do with this?

---

<div class="post-metadata">

**Author:** ![fumeng](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fumeng](https://forum.kirupa.com/u/fumeng)\
**Post date:** [August 3, 2004, 5:55pm UTC](https://forum.kirupa.com/t/functions-path/118205/2 "2004-08-03T17:55:06Z")

</div>

for the most part, ‘this’ is an identifier which references an object or a movie clip (though sometimes it can reference a timeline…look in flash’s reference panel for more on that).

but normally, when a script executes, ‘this’ references the movie clip instance that contains the script.

you’ve got your script on a frame so ‘this’ doesn’t reference anything – that’s why you’re getting an error. but then again you don’t need it to. you already point to what you want to change, i.e. ‘atextfield’ – and that’s enough.

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 6:08pm UTC](https://forum.kirupa.com/t/functions-path/118205/3 "2004-08-03T18:08:37Z")

</div>

i was surprised that your reference to “this” stopped the function working properly and i`ve just tested it and with flash mx it works as typed above.
