PDA

View Full Version : Removing a button...


f3ar
10-17-2005, 11:38 PM
Is there any actionscript to remove a button from the timeline? I have an external preloader where I press "load" and it loads the flash page ON TOP of the button....unfortunately you can still access the load button once the page is loaded on top....is there a way to completely remove it from the timeline after it is pressed?

Thanks in advance,
F3ar

madgett
10-18-2005, 03:34 AM
You would use destroyObject():btn.onPress = function() {
destroyObject(this._name);
};

f3ar
10-18-2005, 04:11 AM
That didn't work, here is the AS I have for my button instanced movie1_btn...

movie1_btn.onPress = function(){
startPreload("home.swf");
destroyObject("movie1_btn");
}

I also tried

destroyObject(this._movie1_btn);

What gives? :(

madgett
10-18-2005, 04:52 AM
destroyObject() is for components. If you manually created a movieclip on the stage then you use movie1_btn.unloadMovie();. It must be a movieclip and not a button instance. If you have to have a button instance, then make sure it is inside a movieclip instance and you can unload the movieclip instance and it will take the button with it.

mekkfabrics
02-08-2007, 04:37 PM
Hi, Im new here, from sweden.
then make sure it is inside a movieclip instance and you can unload the movieclip instance and it will take the button with it.
How exactly do you do that?
And yes Im a beginner, almost anyway:)

Krisko
02-08-2007, 07:01 PM
I use 2 ways:
movie_btn.onPress = function() {
delete this.movie_btn // this is the one way, it's not so good
this.movie_btn._x += 1000 // this is the dodger way :)
}

mekkfabrics
02-13-2007, 01:38 PM
Im sorry but I cant make it work, where should I put the code, on the timeline? What I want to do is, first to load a movieclip with a button on release that unloads the movieclip and the button at the same time, you know like an ordinary pop up window. my brain is about to explode soon:confused: