If you loaded it from the library via actionscript, you don’t need to do the swapDepths() method as you probably already loaded it into a removeable depth.
As for it not working, It is probably because of the “whoami” when you use removeMovieClip you target it as clip.removeMovieClip() not removeMovieClip(clip). In that script , after you remove the “whoami” you are telling the clip you are pressing to removed.
If that doesn’t work, try changing it to just [AS]this.removeMovieClip()[/AS]
But none of the codes work What am I missing. Bet I am code blind right now since I have been sitting all days with codes. Like to try on my own before I ask… but I always end up asking anyway
Night here in norway so I will go to bed now. Good night,
this._whoami wouldn’t work for multiple reasons. the whoami clip isn’t inside that movie clip, and you don’t target clip instance names with an underscore first.
And I don’t see why none of those didn’t work. Is the clip you are pressing the clip that you want to be removed?
The code isn’t working not because of the code, but because of how you have this set up.
When you load the movie you add onPress and onRelease actions to the clip to make it draggable, but see, this makes the whole thing a button.
And this button is over top of your button inside of the clip. So therefore the button inside the movie clip cannot be pressed.
To fix this we will need to make a new button inside the clip that will be used to drag instead of the main clip itself. You can do this by changing this [AS]myButton.onRelease = function() {
this._parent.attachMovie(“myMovieClip”, “myMovieClip”, 0, {_x:240, _y:140, onPress:startDrag, onRelease:stopDrag});
};[/AS] to this… [AS]myButton.onRelease = function() {
this._parent.attachMovie(“myMovieClip”, “myMovieClip”, 0, {_x:240, _y:140});
};[/AS]
Then making the white area of your movie clip a movie clip symbol or a button symbol with the instance name “drag” (no quotes) so that the code above will target it to be a button and draggable.
Hmm, thats weird. Kirupa is working on setting up themes for the forum that you can choose in your user options, perhaps in that process things were acting oddly and that is why it didn’t work.