Jump to content
  • Advertisement
Sign in to follow this  
Brash Benson

[web] Flash: removeMovieClip() not working

This topic is 4342 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm just fiddling around with Flash, trying to make something similar to the starfield and flying windows screensavers, and what I have right now does the trick, except for one thing. Once my objects get to a certain size, I want to remove them so the screen doesn't get cluttered. Here's my code:
ballDepth = 9999999;
ballID = 1;

createEmptyMovieClip("balls", 1);

ballObj = new Object();
ballObj.onEnterFrame = ballEnterFrame;
ballObj._x = 250;
ballObj._y = 250;
ballObj._xscale = 1;
ballObj._yscale = 1;

function ballSpawn() {
	ballObj.X = getRandom(-10, 10);
    ballObj.Y = getRandom(-10, 10);
	ballObj.myScale = getRandom(1, 5);
	attachMovie("ball", "ball"+ballID++, ballDepth--, ballObj);

function ballEnterFrame() {
	this._x += this.X;
	this._y += this.Y;
	this._xscale += this.myScale;
	this._yscale += this.myScale;
	if(this._xscale > 300)

function getRandom(min, max) {
	return Math.floor(Math.random() * (max - min + 1) + min);

setInterval(ballSpawn, 20);

For some reason, my "this.removeMovieClip();" in my ballEnterFrame function doesn't remove the clip! Nothing I've tried works, so I'm kinda stuck. Can anyone help?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!