I need to attach an MC from the library to the content in a scrollpane, but can't seem to figure out the right line of code to do it.
This works perfectly for creating an empty movie clip at _root and attaching the movie clip from the library:
var myButton = _root.createEmptyMovieClip("btnName", _root.getNextHighestDepth());
var myButton_mc = myButton.attachMovie("btnAdd", "btnAdd_mc", 0);
Now I need to do the same in a scrollpane. For a separate purpose in this scrollpane, I have successfully created an empty movie clip and loaded an external JPG using:
_root.scrollpane.content["image1"]._x = 5;
_root.pipeMenuPane.content["image1"]._y = 5;
var imageMCLoader:MovieClipLoader = new MovieClipLoader();
So I thought this would work to create an empty movie clip in the scrollpane and attach a movie clip to it:
var BtnHld = _root.scrollpane.content.createEmptyMovieClip("btnName", _root.scrollpane.content.getNextHighestDepth());
var Btn_mc = BtnHld.attachMovie("btnAdd", "btnAdd_mc", 0);
Sadly, that doesn't work.... The create empty movie clip works and traces correctly, but tracing the Btn_mc for the attachMovie returns undefined, and the movie clip remains empty.
Since this works to attach to _root, and even to _root.scrollpane (which creates movie clips that don't move when the scrollpane is scrolled and float over its content), I'm baffled why I can't get this to work.