Forum Topic: using removeMovieClip() ; function

(192 views • 10 replies)

This topic is 1 page long.

<< < > >>
Happy

iluvAS

Reply To Post Reply & Quote

Posted at: 10/23/08 07:27 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

Im currently working on a platformer. The character has to pick up items ive scattered throughout the stage. Ive put in this code to the pickable coin

onClipEvent(enterFrame){
if(_root.mc.hitTest(this)){
_root.mc.point+=1
removeMovieClip(this)
}
}

the first part of adding the point works but how do i make it removemovieclip. putting that in did not remove the coin from the stage. How can i use this function properly and perhaps is there any other way to remove a movie clip from the stage through actionscript?


Muted

suicidalnene

Reply To Post Reply & Quote

Posted at: 10/23/08 07:29 AM

suicidalnene EVIL LEVEL 13

Sign-Up: 06/03/07

Posts: 752

removeMovieclip only works with movieclips that are duplicates or are created through actionscript

psn: jdsrockin

BBS Signature

None

BillysProgrammer

Reply To Post Reply & Quote

Posted at: 10/23/08 07:31 AM

BillysProgrammer LIGHT LEVEL 16

Sign-Up: 09/17/08

Posts: 2,260

At 10/23/08 07:29 AM, suicidalnene wrote: removeMovieclip only works with movieclips that are duplicates or are created through actionscript

Actually, thats incorrect, as long as there is a loop, function, or action going on that triggers something, then it will remove


Muted

suicidalnene

Reply To Post Reply & Quote

Posted at: 10/23/08 07:34 AM

suicidalnene EVIL LEVEL 13

Sign-Up: 06/03/07

Posts: 752

At 10/23/08 07:31 AM, BillysProgrammer wrote:
At 10/23/08 07:29 AM, suicidalnene wrote: removeMovieclip only works with movieclips that are duplicates or are created through actionscript
Actually, thats incorrect, as long as there is a loop, function, or action going on that triggers something, then it will remove

o really? Now i know

psn: jdsrockin

BBS Signature

None

BillysProgrammer

Reply To Post Reply & Quote

Posted at: 10/23/08 07:37 AM

BillysProgrammer LIGHT LEVEL 16

Sign-Up: 09/17/08

Posts: 2,260

At 10/23/08 07:34 AM, suicidalnene wrote:
At 10/23/08 07:31 AM, BillysProgrammer wrote:
At 10/23/08 07:29 AM, suicidalnene wrote: removeMovieclip only works with movieclips that are duplicates or are created through actionscript
Actually, thats incorrect, as long as there is a loop, function, or action going on that triggers something, then it will remove
o really? Now i know

Yep, Theres a tutorial in AS:Main that explains it more clearly if you wanna go check it out!

Cheers!


None

iluvAS

Reply To Post Reply & Quote

Posted at: 10/23/08 08:01 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

errr ok so is there anyway that i can remove my coin from the stage once i pick it up?


None

Jindo

Reply To Post Reply & Quote

Posted at: 10/23/08 08:15 AM

Jindo LIGHT LEVEL 22

Sign-Up: 08/30/05

Posts: 1,786

tried this.removeMovieClip(this); or _root.removeMovieClip(this);? Sometimes you need to do something like that ;(.

:D


None

iluvAS

Reply To Post Reply & Quote

Posted at: 10/23/08 08:30 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

err it didnt work T_T


None

reefermadness

Reply To Post Reply & Quote

Posted at: 10/23/08 08:45 AM

reefermadness NEUTRAL LEVEL 03

Sign-Up: 04/13/07

Posts: 42

Have you tried:

onClipEvent(enterFrame){
if(_root.mc.hitTest(this)){
_root.mc.point+=1
this.removeMovieClip(); //REMEMBER THAT IT DOESNT NEED PARAMS WHEN USING THIS METHOD!!!
}
}


None

Moonkey

Reply To Post Reply & Quote

Posted at: 10/23/08 08:49 AM

Moonkey DARK LEVEL 07

Sign-Up: 05/11/07

Posts: 919

removeMovieClips only work on things with a positive depth value. Things that are placed on the stage at authoring time are given a negative depth, so you need to swap them up to a positive depth before you remove them.

add something like this before you remove it

this.swapDepths(_parent.getNextHighestDepth());

None

iluvAS

Reply To Post Reply & Quote

Posted at: 10/23/08 09:30 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

WOOTZ thankz it works ^^


All times are Eastern Standard Time (GMT -5) | Current Time: 11:55 PM

<< 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!