Be a Supporter!

As2 - removeMovieClip Targeting

  • 187 Views
  • 6 Replies
New Topic Respond to this Topic
Kwing
Kwing
  • Member since: Jul. 24, 2007
  • Offline.
Forum Stats
Member
Level 45
Game Developer
As2 - removeMovieClip Targeting 2014-05-24 18:43:25 Reply

Back in the day I used to use unloadMovie to get rid of Movie Clips. I've since started using removeMovieClip because it actually gets rid of the entire Movie Clip rather than simply unloading the graphic. I've found removeMovieClip does an excellent job of removing the lag that occurs when using unloadMovie on a mass scale.

However, I've been having a lot of trouble getting removeMovieClip to target what I want it to. Something as simple as:

removeMovieClip('myMC');
//or
myMC.removeMovieClip();

... simply does not work, while unloadMovie correctly targets and removes the Movie Clip.

However, in a separate line of code, I have this...

removeMovieClip(_parent[_parent.bulletArray[s]]);

... Which for some reason works correctly. This line is part of a for... in function and it correctly identifies any bullet in the array given and removes it when it's supposed to. I've busted my balls trying to figure out what the difference is and I honestly can't. The only possible difference I can come up with is that the bullets are called onto the stage with attachMovie, whereas with the other example I've plopped the Movie Clip on the stage manually. Is that what's making up the difference?


If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to As2 - removeMovieClip Targeting 2014-05-24 20:48:00 Reply

First realize that AS2 is officially unsupported as of about a year ago, it's a dead language, the only reason you'd use it is if you were used to it, and in that case you wouldn't need help. AS3 is faster, more compatible, free to program with, and generally better made.

As for your issues, you can't removeMovieClip things that have a negative depth, so if you added it on the timeline it will have a negative depth by default. It's just a little bullshit thing AS2 does, another reason not to use it, it's full of little things like that you just have to know.

swapDepth(myMc, myMc.parent.getNextHighestDepth());


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
Kwing
Kwing
  • Member since: Jul. 24, 2007
  • Offline.
Forum Stats
Member
Level 45
Game Developer
Response to As2 - removeMovieClip Targeting 2014-05-24 21:46:32 Reply

At 5/24/14 08:48 PM, MintPaw wrote: free to program with

Wait a minute, what? I must have missed the memo. I have Macromedia Flash Professional 8, and you're telling me it's free to program with AS3? Tell me how I can get in on this.


If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to As2 - removeMovieClip Targeting 2014-05-24 23:02:04 Reply

At 5/24/14 09:46 PM, Kwing wrote:
At 5/24/14 08:48 PM, MintPaw wrote: free to program with
Wait a minute, what? I must have missed the memo. I have Macromedia Flash Professional 8, and you're telling me it's free to program with AS3? Tell me how I can get in on this.

http://flashdevelop.org

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to As2 - removeMovieClip Targeting 2014-05-24 23:39:13 Reply

^
You can also simply download Adobe's free Flex compiler and compile using the command line, but if you're on Windows then Flashdevelop is the way to go.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
Kwing
Kwing
  • Member since: Jul. 24, 2007
  • Offline.
Forum Stats
Member
Level 45
Game Developer
Response to As2 - removeMovieClip Targeting 2014-05-31 20:12:06 Reply

At 5/24/14 11:02 PM, MSGhero wrote: http://flashdevelop.org

I feel really nooby here, but how the heck does this thing work? I tried to run a hello world in AS3 and it tells me there's no valid SDK defined. I don't even know what and SDK is.

Also, how do I combine this with whatever graphics or animations I've made in Flash 8?

(Also, tried looking at a tutorial but I couldn't see what the heck the guy was typing.)


If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)

Sam
Sam
  • Member since: Oct. 1, 2005
  • Offline.
Forum Stats
Moderator
Level 19
Programmer
Response to As2 - removeMovieClip Targeting 2014-05-31 20:19:05 Reply

At 5/31/14 08:12 PM, Kwing wrote:
At 5/24/14 11:02 PM, MSGhero wrote: http://flashdevelop.org
I feel really nooby here, but how the heck does this thing work? I tried to run a hello world in AS3 and it tells me there's no valid SDK defined. I don't even know what and SDK is.

Because you've had that hidden from you with the Flash IDE. Flex is the SDK you need which lets you build to AIR and Flash Player.

Also, how do I combine this with whatever graphics or animations I've made in Flash 8?

You can export your graphics to an SWC to use them in FlashDevelop projects, or you can export or build a spritesheet and import the graphics as bitmaps.