Removing buttons

When a button is pressed, it activates a movie clip and tells the clip to play. After the button is pressed, I want it to… delete itself or something, just so its no longer there. (That, or I want after the movie clip reaches the end, it would delete itself).

The easiest way would be this script:

on (release){
this._visible = false;
}

It makes everything dissapear… :frowning:

Did you apply it to the button? It should only make the button disappear.

Could the fact that theres other scripting in it effect it?

on (release) {
tellTarget(_root.head) {
gotoAndPlay(41);
}
this._visible = false;
}

Try this:[AS]on (release) {
this.blah._visible = false;
tellTarget (_root.head) {
gotoAndPlay(41);
}
}
[/AS]

blah would be the instance name of that button.

*Originally posted by FireDrake101 *
**Could the fact that theres other scripting in it effect it?

on (release) {
tellTarget(_root.head) {
gotoAndPlay(41);
}
this._visible = false;
} **

[AS]on (release) {
_root.head.gotoAndPlay (41);
_root.intance of your button._visible = false;
} [/AS]

that’s smaller, and correcter!

haha that’s the same thing I posted. :stuck_out_tongue:

Four minutes between our posts

aaargh, stop it electron… :stuck_out_tongue: :wink:

I win, whoohow… :wink:

Actually Didius did win EG…lol.

tellTarget is old and not used anymore.

And you can’t us “this” on a button clip otherwise it acts as a global property and makes everything in that timeline invisible (if using _visible = false that is) so you need to target it’s instance name.

HOWEVER, as Didius used _root, that is not wise because it may cause complications if this movie gets loaded into another movie.

In that case this should suffice…

[AS]on (release) {
head.gotoAndPlay (41);
buttonInstanceName._visible = false;
}[/AS]

Of course that assumes the head clip is on the same timeline as your button.

Ello,

Well if you really wanted to ‘Delete’ your button, can’t see why but you could do it this way.

Make your button, put it into a movieClip. Then on watever frame of your main timeline using the attachMove method you can retrieve the movie clips that contain the buttons from the library, place them where you want.

Then to take them away you use the removeMovieClip method. This will take the button (which is in a movieClip remember) off the stage.

Viru.

What do you mean by tellTarget is old and unused? I use it… :frowning:

Flash 4 and 5 used it. Its not obhect oriented like flash MX’s actionscript is.

You can still use it but its not ‘good’ coding practice. Java rules!!

Viru.

Another good method k02n, I was operating under the assumption of him possibly wanting to bring the button back at some time (so he could set _visble to true and voila, done), but if the button is going to be completely deleted and done with then your method is good as well.

*Originally posted by kO2n *
**Flash 4 and 5 used it. Its not obhect oriented like flash MX’s actionscript is.

You can still use it but its not ‘good’ coding practice. Java rules!!

Viru. **

Flash 5 still used it, but I have no clue why since it had the dot syntax method implemented… I never really understood why it was still standard practice in Flash 5 to use tellTarget and setProperty :-\ I don’t know, I started flashing after Flash 5 so maybe I missed something then.

And I hear Java rules… I want to learn Java… :drools:

Yup, thats why i mentioned i couldnt see why he’d want to ‘delete’ the button at all. So your answer was the one he wanted.

Viru

Well in Flash 5 the dot syntax was just a syntax. It was just an ‘old’ style programming way. Flash MX has incorporated as I said before an ‘Object Oriented’ programming style. This sort of programming is more efficient and can in some situations making solving a problem more intuitive and easier. I wont go to deep into cos I had a year of the ‘fundementals’ of Java…zzzzzz. Haha

Viru.

Thanks for the info, but I think I am still confused.

Flash 4 and lower used the old style called “slash syntax”, Flash 5 was the first to incorporate the new “dot syntax” where you could do “clip.property = something” and whatnot.

Was the dot syntax in Flash 5 just experimental/work in progress and that is why the old slash syntax was still considered for normal use?

And don’t worry about boring me, I am an avid coder and I enjoy learning new things. Unfortunately though, I jumped into the Flash game a bit late so I missed a lot of the past stuff, which has it’s advantages and disadvantages.