View Full Version : newbie question :P
Mikal911
11-09-2001, 05:55 PM
Can someone plz help me I need some help I have 2 MC's and need one of the to go away after a hit test. Can anyone tell me how i can do that?
thanks
Mikal
wangbar
11-09-2001, 07:09 PM
The easiest thing to do is just to make it invisible...
myMovieclip._visible=false;
...will do it.
If the clip was created via attachMovieClip or duplicateMovieClip then you could also get rid of it totally by using...
myMovieCclip.removeMovieClip();
Mikal911
11-09-2001, 07:16 PM
Thans i will give it a shot.
Mikal911
11-09-2001, 09:35 PM
ok.. i duplicated a mc 10x to appear in random positions when i have my other MC go around and hittest for the duplicate i have them add +1 to a variable elsewhere in my movie but i want them all to begone after that but it seems that one always wants to hang around and i cant get rid of it any suggestions??
onClipEvent (enterFrame) {
if (this.hitTest(_root.player1._x, _root.player1._y, true))
tellTarget ("_root.display") { pl1pow = pl1pow +1
this.removeMovieClip()
}
here is the code i am using
thanks for your time
Mikal
you can only use removeMovieClip() to remove MCs created with duplicateMovieClip()or attachMovieClip().
so if you started with the movieclip on you stage that one won't be removed with removeMovieClip() you will need to do what wanbar suggested and set the visible property to false or remove the original movie clip from the stage at design time and use code and attachMovieClip() to create all of your mcs.
does ANY of that make sense?
Mikal911
11-10-2001, 12:40 AM
I have my Mc attached now and its working the all appear on screen like supposed to. Now the problem is when i move my 1st mc over them they do not not go away. here is my code now
onClipEvent (load) {
this._x = random(640);
this._y = random(480);
scale = random(50)+50;
this._xscale = scale;
this._yscale = scale;
}
onClipEvent (enterFrame) {
if (this._x>=640) {
this._x = 0;
} else if (this._x<=0) {
this._x = 640;
} else if (this._y>=480) {
this._y = 0;
} else if (this._y<=0) {
this._y = 480;
}
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player1._x, _root.player1._y, true))
tellTarget ("_root.display") { pl1pow = pl1pow +1
this.removeMovieClip()
}
}
thanks in advance
Mikal
this is what you have posted as your code...
onClipEvent (enterFrame) {
if (this.hitTest(_root.player1._x, _root.player1._y, true))
// i think this tellTarget should be wrapped in {}(for the if statement)
tellTarget ("_root.display") {
pl1pow = pl1pow +1
/*
is this next statement (removeMovieClip()) part of _root.display??
because it looks like it is wrapped inside the tellTarget Code...
should it be outside the tellTarget???
*/
this.removeMovieClip()
}
}
i guess what i am saying is should it look like this?
onClipEvent (enterFrame) {
if (this.hitTest(_root.player1._x, _root.player1._y, true)) {
tellTarget ("_root.display") {
pl1pow = pl1pow +1;
}
this.removeMovieClip();
}
}
i'm just making alot of wild assumptions here, cause i don't know what all your code looks like, so i guess i'm just blowin hot air as usual.
Mikal911
11-10-2001, 02:20 PM
Sorry tg I have never coded before and dont know much about it. I guess i need practice on my format. thanks for taking the time to look at it.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.