Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Can't make a movie symbol disapear via code


jthees
4/30/2004 9:32:59 PM
I'm creating a game, with a score counter that triggers events. The first event
adds a "boss" character to the stage when a certain score is reached. The boss
is an animated movie clip (BossX_B) that scrolls around the screen and attempts
to kill you.

In frame 1, I define varibles as:
BossXAlive = false;
BossXExists=false;
NextLevel=false;

The counter tracks the score, and on a certain score, sets BossExists=true.

Then, on I've got a loop that looks for BossExists to be true and executes the
following:

[h]if (BossXAlive == true) {
if (BossXExists == false) {
BossXExists = true;
_root.attachMovie("BossX_B", "BossX", 9999)
}
}[/h]

This works just fine, and he appears and does what he's supposed to do. The
problem lies in getting rid of him. At the next event on the score board, it
should remove the boss, and goto and play another scene.

The at a certain score, the scorer sets [h]NextLevel=true;[/h] then the game
loops through with this code:

[h]if (NextLevel == true) {
_root.removeMovieClip("BossX_B")
gotoAndPlay(31);
}[/h]

My problem is, it goes to frame 31 just fine, but completly ignores the remove
command. The boss just keeps on keeping on... I've tried every combination I
can think of... ("BossX_B", "Boss", 9999) - ("BossX_B", "Boss"), etc...

Sorry if this sounds dumb... I'm a noob to Action Scritpt.

-Jason



jthees
4/30/2004 9:43:16 PM
I just solved my own problem... the syntax should be
[h]_root["BossX"].removeMovieClip("BossX_B");[/h]...

I hate when I spend hours on something, totally lost, finally thrown the towel
in and ask for help and immediately figure it out... Thanks for reading, though.

-Jason
AddThis Social Bookmark Button