View Full Version : AttachMovie not working

Shirk Deio
07-15-2009, 02:44 AM
This is an incredibly frustrating problem for me. I'm an advanced ASer (AS2) and I'm having problems with the most basic function here, attachMovie.

I have a tile-based engine I've been working on. I'm using a gotoAndStop engine to scroll the tiles when the character moves. That's where my problem is.

When I go down and right one tile (scrolling) then scroll up one tile, the far left upper tile doesn't go to the proper frame, but plays the tile movieclip.

I spent an hour using trace functions to figure out what was going on, and I found out that the attachMovie function isn't working for that one tile.

I use a for loop to change tiles.


If I trace this on the second-to-last tile, it returns the movieclip. If I trace this on the last tile, it appends a blank line to the output box - there's the problem. It's not the upper left tile that's screwed up, it's the upper right tile that isn't getting placed on the proper x value because attachMovie is screwing up.


If I trace those on the last tile, the first trace outputs a blank line, and the second trace outputs the correct movieclip!

What is going on? This is crazy, and I have a deadline I'm trying to meet. I would really appreciate any help you could offer.

Shirk Deio
07-15-2009, 03:02 AM
I made it work by adding a line of code. When I removeMovieClip for an old tile, I also delete the old tile so it leaves nothing behind. I'm not sure why it needed that, but it did and now it works.