I've been meaning to post about this error for awhile. You can find solutions on the web, but they seem very buried... hence all the key words in my title.
The error appears in Flash 9 when you use a loader more than once and try to add the e.target.content to the DisplayList after each load. If you are running Flash 10, you will not see the error... The biggest lesson I took from this error is to continue to test on older versions of Flash. If you set your publish settings to Flash 9, but have Flash 10 downloaded on your machine.... you still need to test your site on a machine with Flash 9. Pain in the arse, but worth it if it means catching errors before the client.
Anyways, back to the error at hand, you have a class loader that has been initiated and you plan on using it for your photo gallery. The first image loads just fine and in the completeHandler you add the image (e.target.content) to the stage using addChild and casting the content as some sort of display object. The second image loads just fine, but in the completeHandler at the line where you call "addChild" and error #2505 will get thrown saying that "The supplied DisplayObject must be a child of the caller".
Hmmph. It worked once, why would it fail?
It has something to do with Flash 9's Loader keeping a reference of its content even after the content has been added to a new parent. A quick and dirty fix to the problem is to make a new Loader for every item you are loading. That worked for my needs, however you may want to be careful with memory and garbage collection if you are loading an intense number of images.
Omar Faleh suggests either casting the content as a DisplayObject and unloading the loader or making a copy of the BitmapData and using the copy instead of the content.
Ed had his 2505 errors occurring when he called "unload()" after adding the e.target.content to the displayList. He suggests adding the Loader to the stage instead of the content. So you would add just "e.target" INSTEAD OF "e.target.content" to the display list.
In any case, there are plenty of work-a-rounds. The important thing is to be aware of the issue and make sure you continue to test your sites on older versions of Flash... even if your personal computer runs on 10.