Let's say i'm making a dressup game (i know, the bottom of the worst). I have a button with a miniature version of a shirt, and when you click it, another button of the real sized shirt is then placed on top of the naked character. If you click on that shirt, it deletes itself.
How do i do this? I tried using MovieClipName.attachMovie() and MovieClipName.removeMovieClip(), but neither worked, is there something i'm missing? Or am i doing it wrong altogether?
EDIT: More info, this is the AS of the button i want to press so the suit appears:
on (press) {
scenarie.attachMovie("suit_white", "suit_white", 1);
suit_white._x=247;
suit_white._y=242;
}
scenarie is a movie clip that covers the entire frame.
suit_white is the name (and instance name) of the button that should appear in the coordinates specified, this button is not present on the stage (nor outside) but in the library.
I press the button and nothing happens.
Thanks in advance to anyone who might read this.
EDIT2:
Alright, so i got the first part working with the following code:
on (press) {
_root.attachMovie("suit_white", "suit_white", 6);
suit_white._x=247;
suit_white._y=242;
}
, now the object appears in the proper place and as many times as i want, but now i don't have any means of deleting it once its pressed, since i cannot add behaviors to the created button, so i tried to replace that button for a movieclip that contains said button with the following code:
on (press) {
this.removeMovieClip();
}
but it won't disappear once i click on it.
EDIT 3: Fuck everything i had done, i managed to make it work, only to discover that attachMovie only allows you to create ONE movieclip, so if i click on the shirt, and then on the pants, the shirt gets erased! Argghhh