Forum Topic: Removing movieclips in AS2 - Help?

(78 views • 8 replies)

This topic is 1 page long.

<< < > >>
Resigned

savagehare99

Reply To Post Reply & Quote

Posted at: 10/5/09 08:42 AM

savagehare99 NEUTRAL LEVEL 01

Sign-Up: 10/05/09

Posts: 5

Does anyone know how to remove movieclips in AS2?
Help
Here is my code so far:

on enterFrame = function (){
if (root.Player2.hitTest(root.Coin3)){
Coin_3.removeMovieClip();
score += 1;
}

Note: Player_2 and Coin_3 are both instance names. The code is also assigned to the frame, not the clips.

Savagehare99


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 10/5/09 09:21 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

two things,
1, how did you add them, through action script or by dragging them onto the frame?
2, why is your function like that, shouldent it be onEnterFrame = function?

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

hdxmike

Reply To Post Reply & Quote

Posted at: 10/5/09 10:39 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,831

At 10/5/09 09:21 AM, Yambanshee wrote: two things,
1, how did you add them, through action script or by dragging them onto the frame?
2, why is your function like that, shouldent it be onEnterFrame = function?

Ditto.
Also if you dragged them into scene ( if they were there when the movie started ) you cant get rid of them otherwise Coin_3.removeMovieClip(Coin_3) or what you did cant remember
If you want to get rid of them make sure there not there and use attachmovieclip fuction K

Or have an off screen Mc to duplicate but i wouldnt suggest that

also . Use AS3 and make a classes, its better

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

UnknownFury

Reply To Post Reply & Quote

Posted at: 10/5/09 10:42 AM

UnknownFury EVIL LEVEL 26

Sign-Up: 08/10/05

Posts: 6,027

At 10/5/09 10:39 AM, hdxmike wrote: Also if you dragged them into scene ( if they were there when the movie started ) you cant get rid of them otherwise Coin_3.removeMovieClip(Coin_3) or what you did cant remember

Yes you can. You just have to give it a positive depth (using swapDepths()) before removing if you didn't add the MC via code as it will by default have a negative depth. His function was right. If you do Coin_3.removeMovieclip(Coin_3) then you're looking inside Coin_3 for an mc called Coin_3 which isn't right.

Portfolio(Under construction): UnknownFury.com |
Msn: giant_ak_47@msn.com | Contact: me@unknownfury.com
Follow me on twitter!


None

hdxmike

Reply To Post Reply & Quote

Posted at: 10/5/09 10:50 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,831

My mistake, i said i couldnt remember
Any way thats right just give it a positive depth

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

savagehare99

Reply To Post Reply & Quote

Posted at: 10/5/09 12:47 PM

savagehare99 NEUTRAL LEVEL 01

Sign-Up: 10/05/09

Posts: 5

so... any code anyone could give me?

Savagehare99


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 10/5/09 12:54 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

At 10/5/09 12:47 PM, savagehare99 wrote: so... any code anyone could give me?

you haven't told us how you added it...

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

savagehare99

Reply To Post Reply & Quote

Posted at: 10/6/09 03:12 PM

savagehare99 NEUTRAL LEVEL 01

Sign-Up: 10/05/09

Posts: 5

I dragged them onto the stage.

Savagehare99


None

savagehare99

Reply To Post Reply & Quote

Posted at: 10/13/09 02:24 PM

savagehare99 NEUTRAL LEVEL 01

Sign-Up: 10/05/09

Posts: 5

never mind, figured it out now

Savagehare99


All times are Eastern Standard Time (GMT -5) | Current Time: 01:22 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!