I am have problems with the removeMovieClip() function;
I have tried several methods to get the function to work. see below
newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);
none of them seemed even remotely effective.
I created the movieclip dynamically so the removeMovieClip function should work.
Below is the code for my Movie Clip
THERE WAS A BUG I EDITED THIS CODE POST
[COLOR=#000000][COLOR=darkolivegreen]//seperates this movieclip from the parent from which it is duplicated from (now bRequestRotation)
[/COLOR][COLOR=darkolivegreen]//var bBulletActive:Boolean = new Boolean(false);
//dynamically changes the bullet velocity.(not in use)
//var nBulletVelocity:Number = new Number(5);
//a number that is set by the parent mc.
[/COLOR]var nBulletAngle : Number;
[COLOR=darkolivegreen]//starting value for the timer[/COLOR]
var nTimer : Number = new Number (0);
[COLOR=darkolivegreen]//timer function based on 12fps about a sec.
[/COLOR]var nTimerMax : Number = new Number (15);
var newThis = this;
[COLOR=darkolivegreen]//stores the movieclips number which is also the clip's depth
[/COLOR]var nStoredLocation;
[COLOR=darkolivegreen]//boolean which is activated by a parent movieclip
[/COLOR]var bRequestRotation;
function fRequestRotation ()
{
[COLOR=darkolivegreen]//trace("fRequestRotation Running")
//trace("Bullet: "+ newThis);
[/COLOR] if (bRequestRotation == true)
{
[COLOR=darkolivegreen]//mathematical function run for the duration(AKA, the bullets movement)
[/COLOR] if (nTimer < nTimerMax)
{
[COLOR=darkolivegreen] //converts degrees to radians which is handled by flash
[/COLOR] nBulletRadian = (nBulletAngle / 180) * Math.PI;
[COLOR=darkolivegreen] //calculates the speed
[/COLOR] dy = (15 * Math.sin (nBulletRadian));
dx = (15 * Math.cos (nBulletRadian));
[COLOR=darkolivegreen]//pointer to this clip; moves it horizontally and vertically
[/COLOR] newThis._x += dx;
newThis._y += dy;
[COLOR=darkolivegreen] //["bullet_mc"+nStoredLocation]
//trace("dx: "+dx +" Loaction X: "+this._x);
//trace("dy: "+dy+" Loaction Y: "+this._y);
//progresses the timer variable
[/COLOR] nTimer ++;[/COLOR]
if(nTimer>nTimerMax)
{ [COLOR=darkolivegreen] [/COLOR][COLOR=darkolivegreen]//[COLOR=darkolivegreen]removes[/COLOR] this interval[/COLOR]
clearInterval(iRequestRotation);
[COLOR=darkolivegreen] //removes movieclip[/COLOR]
newThis.removeMovieClip();
newThis.unloadMovie();
unloadMovie(newThis);
newThis.unloadMovie;
[COLOR=darkolivegreen] //trace("Location: "+newThis._parent["bullet_mc"+nStoredLocation])[/COLOR]
removeMovieClip(newThis._parent["bullet_mc"+nStoredLocation]);
[COLOR=darkolivegreen] //setTimeout an undocument Function calls the function once after a time delay[/COLOR]
[COLOR=darkolivegreen] //setTimeout(fUnloader,1000);[/COLOR]
trace("Movie Unloaded");
}
trace(newThis);
}
}
//sets an interval that is activated on startup
var iRequestRotation = setInterval(fRequestRotation, 1000 / 12);
i’ve tried everything i can think of any help at all would be greatly appreciated.