# Attachmovie, why wont it work?

**URL:** <https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878>\
**Category:** Uncategorized\
**Created:** [August 18, 2004, 7:36pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878 "2004-08-18T19:36:05Z")\
**Posts on this page:** 8\
**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 18, 2004, 7:36pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/1 "2004-08-18T19:36:05Z")

</div>

I am getting very frusterated with attachMovie()  
i have the following code on the main timeline:

```auto

this.attachMovie('pic_box', 'pic_box', 0, {_x:10, _y:10})
this.pic_box.attachMovie('load_bar', 'load_bar', 1, {_x:100, _y:100})

```

everything is in the library correctly.  
now the ‘pic\_box’ gets attached but the other one doesn’t. if i do this:  
\_root.attachMovie(‘load\_bar’, ‘load\_bar’, 1, {\_x:100, \_y:100})  
it attaches fine.  
I have a class attached to the pic\_box, and if i remove the class ID in the linkage panel, it attaches the load bar. It has nothing to do with what is contained in the class because if i comment out all the code but the:  
class name {}  
it still doesn’t work.  
I am REALLY stumped…

---

<div class="post-metadata">

**Author:** ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)\
**Post date:** [August 18, 2004, 8:32pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/2 "2004-08-18T20:32:23Z")

</div>

are you sure it’s not meant to be [and] instead of { and }

that’s what it looks like in the reference. also: check to see whether or not you should be using the \_ before the x and y parameters.

---

<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 18, 2004, 8:39pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/3 "2004-08-18T20:39:09Z")

</div>

which thing are you talking about the class, or the attachmovie?  
Either way, i know i did that right, because its worked in other projects i’ve done, i’ve just never needed to attach a movie, and then attach a movie to the attchted movie.

---

<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 18, 2004, 8:59pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/4 "2004-08-18T20:59:47Z")

</div>

now have a look at this, i dont know if i am going mad or something, but i SWORE, that the only way you can have a MC use a class is if you use attachmovie…  
well, have a look at the file i have attachted. Any ideas of why is it doing this?

---

<div class="post-metadata">

**Author:** ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)\
**Post date:** [August 18, 2004, 10:11pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/5 "2004-08-18T22:11:58Z")

</div>

i can’t open that file. i’m running flash MX.  
and i mean: on this line:

```auto
this.attachMovie('pic_box', 'pic_box', 0, {_x:10, _y:10});

```

should you not use [and] instead of { and } so that you have:

```auto
this.attachMovie('pic_box', 'pic_box', 0, [_x:10, _y:10]);

```

if you could format the document for MX then i’ll have a proper look, see if i can get it working myself and tell you where your problems lie.

---

<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 18, 2004, 10:20pm UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/6 "2004-08-18T22:20:46Z")

</div>

well, since the code is written in AS 2 class format and mx is AS 1 i dont think it would work if i give it to you anyway…

---

<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 19, 2004, 12:07am UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/7 "2004-08-19T00:07:36Z")

</div>

I think i have narrowed down the problem.  
Is has to do with assigning classes to a MC thats in the library and then **modifying** something to the MC in the library that had a class assigned to it. Modifying includes loading a jpg or attaching a another MC onto it.  
Look at the fla and .jpg i have attached (mx2004only), if you change the class ID of the pic\_cont in the library to nothing it loads fine, if you have it changed to the pic\_cont class then it doesn’t work…  
if anybody has ANY idea on how to fix this, i would GREATLY appreate it! :nerd:

---

<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 19, 2004, 1:52am UTC](https://forum.kirupa.com/t/attachmovie-why-wont-it-work/119878/8 "2004-08-19T01:52:04Z")

</div>

ahhhh,  
i fixed problem.  
My class was only defined by class name{}  
i needed to extend to the movie clip class to inherite all the movieClip class’s functions…  
so i needed to do class name extends MovieClip {  
HTH, anyone who had the same problem as me…
