Attachmovie, why wont it work?

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


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…

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.

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.

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?

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

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

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

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.

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…

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:

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…