[FMX]Duplicating then attaching

I have a program that has an extensive library, it uses the attachMovie function to often put one-frame movies on the screen. However, in one case I need more than one instance of something in the library so I thought the following code would work fine. Oh, and it’s copying the movie “pellet”

var newMovieName = "pellet_"+newPos
pellet.duplicateMovieClip(newMovieName,1)
_root.attachMovie(_root[newMovieName],newMovieName,1)

It just simply won’t work…no matter what I try, can I get some help?

its because you are using the same depth over again, use a different number or better yet a variable that gets 1 added to it everytime you use it


var newMovieName = "pellet_"+newPos
pellet.duplicateMovieClip(newMovieName,depth++)
_root.attachMovie(_root[newMovieName],newMovieName,depth++)

:-\ sorry…it didn’t help…could there be any other problems?

LOL… I am going to take a wild shot in the dark and probably shoot my foot, but does this help?

var newMovieName = _root["pellet_"+newPos]
pellet.duplicateMovieClip(newMovieName,depth++)
newMovieName.attachMovie(newMovieName,depth++)

…they also have the same instance name which isnt exactly good (my first post was a quicky heh)… attachMovie is also missing a parameter

I usually test code I put out before I post it, but I don’t have flash open and my comp is all crazy like, so I figured I would just give it a shot without testing. I always get it wrong when I do that…lol. I have no clue why. I could type it out fine in Flash (always in advanced mode), but when I type it out in the forum I mess something up. Hmmm, oh well :wink:

yeah its a lot faster and easier to throw up a “possibly correct” answer :wink: and if it doesnt work, look at it a little better and give a better one… if it keeps not working then test it heh. Sometimes I dont even ready the question fully (I get a lot of mis-answers doing that though lol)

lostinbeta:

I have tried several times to check your site because you seem to have a bead on what your doing.
I see you have it masked to a sub dir at 8ball.
But the redirect is increadably slow and 404’s all the time.
Just wanted you ta know…

Sen: Yes, same here. I tend to not read fully, or skim fast and miss an important word and end up doing the wrong thing.

rynoe: My server is down. Tech-Support said it was hard drive failure (luckily the backup was done the day before it went down) and they are replacing the hard drive now. They stated that it should be up and running by tomorrow. Notice the footer is not loading as well… same reason.

I see…