Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling a button from a movie clip

Status
Not open for further replies.

simonWMC2

Programmer
Aug 5, 2004
161
GB
Hi Peeps...

I have a 30 frame movie clip that is activated to play from the maintimeline of my fla.
On the last frame of the movie clip i have some code that I want to disable a button on the main timeline.

I have tried
Code:
next_btn1 = function() {
   this._enabled = false;
}

and

Code:
_root.next_btn1.enabled = false;

I have also tried using visable instead of enabled, and tried with and without the _root.

Anyone see what i am doing wrong ?

cheers
 
yep, tried that on the last frame in the movieclip, but it does nothing.

Do you mean put it on the _root timeline ? I can do that but I don't want the button to disappear until the end of the mvie clip.
 
> Do you mean put it on the _root timeline ?

Yes I mean on the main timeline (_root).

> I can do that but I don't want the button to disappear until the end of the mvie clip.

Put it on the last frame of the main timeline then.

Kenneth Kawamoto
 
sadly, can't do that either, as the button will be re-enabled by another movie clip, once the user has triggered it...
 
You can create a function such as:

[tt]// main timeline
function cahngeButtonState(button, buttonState) {
this[button].enabled = buttonState;
}
//[/tt]

Then you can call this function from anywhere:
[tt]//
cahngeButtonState("next_btn1", false); // disable from the main timeline
//
_parent.cahngeButtonState("next_btn1", true); // enable from a nested MovieClip
// etc...
[/tt]

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top