DuplicateMovieClip Frustrations!

Hi Guys,

I’m having a problem duplicating a dynamically created movie clip.

Basically, what I have happening is a loop creates a certain number of movieclips based on some external data, then some PNG symbols are loaded into these clips and are spaced out accordingly. I have up to this part working great.

This is what I am having trouble with: I when these movieclips are pressed, I want them to be duplicated and have a startDrag action invoked on the copy, so that it may be placed anywhere on the Stage.

The code is attached below, please let me know if you have any questions, and thanks in advance!

[AS]
//Load XML and create MovieClips
symbolsXML.onLoad = function (success) {
if (success) {
rootNode = this.firstChild;
total = rootNode.childNodes.length;
counter = 0;
currentx = 10;
currenty = 480;
for (i=0; i<total; i++) {
symbolArray.push(rootNode.childNodes*.attributes.url);
_parent.createEmptyMovieClip(“a”+i, _parent.getNextHighestDepth());
loadImage(i);
_parent[“a”+i]._x = currentx;
_parent[“a”+i]._y = currenty;
currentx += 30;

}
} else {
trace(“file not loaded!”);
}
}

//Function called above to load relative images into movieclips.
function loadImage(numb) {
trace("loading… " + numb);
var picLoader:MovieClipLoader = new MovieClipLoader();
var picListener:Object = new Object();

picLoader.loadClip(symbolArray[numb], _parent[“a”+numb]);

picLoader.addListener(picListener);

picListener.onLoadInit = function () {
trace("loaded " + numb);

_parent[“a”+numb].onPress = function () {
createNew(numb);
}

_parent[numb].onRelease = function() {
stopDrag();
}

_parent[numb].onReleaseOutside = function() {
stopDrag();
}
}
}

//Duplication function (the problem spot)
function createNew(numb) {
trace(“a”+numb);
_parent[“a”+numb].duplicateMovieClip(“copy”+counter, this.getNextHighestDepth());
trace(_parent[“a”+numb]);
trace(_parent[“copy”+counter]);
_parent[“copy”+counter].startDrag(false);
counter++;
}[/AS]

All those traces in the createNew function are firing off, however, I get undefined returned on the trace(_parent[“copy”+counter]);. I have a feeling it’s a scope issue or something… Also, I do not see the duplicated movieclips on the stage.