MX - ghost images

Hi.

I have the code below which rotates a MC and fades it in to 100alpha and then fades it out again to 0 alpha

bearing in mind that all this happens on one frame, is there a way to get rid of the ghost image of the MC once the alpha gets down to 0?

I’ve tried to achieve this at the foot of this code with the removeMovieClip() but it doesn’t seem to work.

I know i could just let the timeline play to another frame once the animation is over to get rid of the ghost image but i’d really like to keep the animation to just the one frame…

is there a way?

Any help would be most appreciated.

[AS]

onClipEvent (load) {
amount = 5;
count = 0

_alpha = 10;
reached100=false
}
onClipEvent (enterFrame) {
_rotation += amount;
count++
if (count == 360) {
amount = 0;
}

if ((_alpha<100) and (reached100==false)){
_alpha+=4;
}
else {
if(_alpha!=0){
reached100=true
_alpha-=4;
}

else {

if (_alpha == 0)
{
this.removeMovieClip();
this.onEnterFrame = null;
}
}

}
}

[/AS]

Hello,

this.removeMovieClip will not work in your case, because it only works on MovieClips that have been made dynamically.
Yours isn’t, otherwise you couldn’t add a “onClipEvent()”

So you need to go back to the thread where you got the fade_in_out script from, and read my reply.
Use that script on a dynamically created object… and your done

Actually you can remove a clip that has not been attached or duplicated. All you need to do is swapDepths it to a positive or null depth.

pom :slight_smile:

I suggest you do not use that buggy method, because that is not the purpose of SwapDepths.
Neither will it remove the onEnterFrame event.