PDA

View Full Version : Newb scripting


Frau_Heibert
05-22-2008, 06:20 AM
I am using Flash Professional 8.

I've added a movie clip to the stage using actionscript. In that movie clip is a movie clip, in a movie clip, in a movie clip. The innermost clip is stopped on it's first frame and when I click it, it plays through the rest of the clip. What can I do so that when it gets to the end of that inmost clip, it removes the entire clip.

Basically, I hit space bar and a balloon floats to the top of a screen. When it's clicked it says POP! But then cycles back to being a balloon again.

I want that balloon to POP! and then disappear.

I feel like this probably has such a simple solution, but I just don't have enough experience with this to know what to do. Can I add script to the last frame on the POP! movieclip that says to delete the entire thing?

I'd appreciate all the help I can get. Thanks!

atomic
05-22-2008, 01:15 PM
On the last frame, you can try...

this.removeMovieClip();

Or...

this.unloadMovie();

Or...

this._visible = false;

Frau_Heibert
05-22-2008, 11:39 PM
Thanks! I was confused because everywhere I looked pointed to using this.removeMovieClip(); but it never worked.

However, this.unloadMovie(); did.

:confused:

atomic
05-23-2008, 02:49 AM
Grrrrreat! ;)

That first line of your's is confusing!

I've added a movie clip to the stage using actionscript...

removeMovieClip() usually only works with created, attached or duplicated movie clips...

When it fails, unloadMovie(); works on most anything...

Frau_Heibert
05-24-2008, 01:25 AM
I can never seem to make myself clear on the internet. It looks right to me. :p What I meant was that on the press of a button, a movie clip is attached ... Well, ten of them (now they're attached to a movie clip called main).

on (keyPress "x") {
for(i=0;i<10;i++) {
var j:MovieClip = main.attachMovie("balloon_mc","balloon_mc"+i, main.getNextHighestDepth());
j._y = 400
j._x = Math.random()*450 + 50;
j._xscale = j._yscale = Math.random()*80 + 20;
}
}


Unfortunately I've found a new couple of problems...

The first has to do with which clip is unloaded. Instead of removing the entire clip I attached (j), it's removing a clip inside of it. This probably has to do with where I put the unload command. But how come I cant just say j.unloadMovie ();?

The second problem is that after the first set of balloons are attached and removed, when a second set goes on, the ballons won't be removed.

Maybe that has to do with the fact that I'm not removing the right movie clip :P

atomic
05-24-2008, 02:13 AM
What's and where is your code to unload the balloons?

nanoflame
05-30-2008, 10:29 AM
You might want to try this:

on (keyPress "x") {
for(i=0;i<10;i++) {
duplicateMovieClip("balloon_mc","balloon_mc"+i, i);
_root["balloon_mc"+i]._y = 400;
_root["balloon_mc"+i]._x = Math.random()*450 + 50;
_root["balloon_mc"+i]._xscale = _root["balloon_mc"+i]._yscale = Math.random()*80 + 20;
}
}