# attachMovie .... specify properties not working properly

**URL:** <https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808>\
**Category:** flash\
**Created:** [May 13, 2003, 5:08pm UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808 "2003-05-13T17:08:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [May 13, 2003, 5:08pm UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808/1 "2003-05-13T17:08:24Z")

</div>

```php

onEnterFrame = function () {
attachMovie ("ball", "ball", 1,[_x=_xmouse, _y=_ymouse]);
}

```

I’ve been having problems with a more complex version of this but just for testing I simplified it and I’m still having the same problem.

the symbol that is attached (ball) jumps between + and - 10 of whatever the value of \_xmouse and \_ymouse are. so basically it moves back and forth diagonally.

does anyone know why?

just copy and paste this code onto a frame and have a symbol exported for actionscript with the name “ball”

any help is appreciated

thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 14, 2003, 1:54am UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808/2 "2003-05-14T01:54:58Z")

</div>

you need to pass an object, not an array 😉

if you are doing it all in one line, directly within the attachMovie call, then you use colons ( : ) as the equals ( = ) ie:

```auto

onEnterFrame = function () {
       attachMovie ("ball", "ball", 1, {_x:_xmouse, _y:_ymouse});
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 14, 2003, 3:35am UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808/3 "2003-05-14T03:35:24Z")

</div>

wow … why do you do that?

that seems confusing

thanks =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 14, 2003, 4:30pm UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808/4 "2003-05-14T16:30:23Z")

</div>

another question … since i have the attachMovie command inside the onenterframe function … does the movie get attached and deleted every frame. what’s the most efficient way to write that code … especially if i’m going to use a ‘for’ loop to make multiple instances of “ball”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 14, 2003, 4:33pm UTC](https://forum.kirupa.com/t/attachmovie-specify-properties-not-working-properly/20808/5 "2003-05-14T16:33:35Z")

</div>

yes it does attach and replace itself every frame

the best way to do it is have it in a function and run that function only once when you need it to be. This most likely wouldnt be in the enterFrame event, more likely in onClipEvent(load) or maybe some mouseDown or called from another action (button?) completely
