How would I programme a button to load a new movieclip over the top of another movieclip on click, and once loaded over the top, remove the previoius one.
Each time the button is clicked a new movie clip is loaded.
Any help gratefully is much appreciated…
Set up all of you MC’s that you want to add for export with action script under properties. Are the movie clips all the same? If you wanted to add different mc’s you can have several buttons but continue to add the movie clips to the same array.
var xPosition:int = “Watever you want your x position of the mc to be”
var yPosition:int = “Watever you want your x position of the mc to be”
var mcArray:Array = new Array();
//create a button on stage with an event listener with corresponding function
btn.addEventListener(MouseEvent.CLICK, addMC)
function addMC(event:MouseEvent):void
{
//check if a movie clip is on stage already
if (mcArray.length > 0)
{
while (mcArray.length > 0)
{
removeChildAt(mcArray[0];
}
}
//dynamically create a new instance of the movie clip you want to use
var newMc:yourMovieClip = new yourMovieClip;
//give the mc its coordinates on screen
newMc.x = xPosition;
newMc.y = yPosition;
//push the mc into an array
mcArray.push(newMc);
// add it to the screen
addChild(newMc);
}