Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Disable Button On Click



How can I disable a button on the click of a second button?



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 11-09-2005, 08:58 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Disable Button On Click?
Hello all.

I have button with the instance name of "a1" in a 2 frame movie clip with the instance name of "toggleMC". It plays a narration sound file.

I also have a button that launches an external SWF (containing video) that has a stopAllSounds; script on it. So if the narration is playing, and the button opening the external SWF is clicked, the narration stops, and the video plays -- all good.

However, if the video is playing (with narration off), "toggleMC" is still active. If the user clicks "toggleMC", the narration plays, the sound from the video stops, and the video keeps playing -- all bad.

How can I disable "toggleMC" or "a1" until the movie is finished playing? I don't want the user to be able to play the narration while the video is playing.

I'm thinking something on the first and last frame of the video beginning with _root.toggleMC.??????? Please help!

Thank you!

Pug

Disable Button For 1 Second After Click
I have a text input and a submit button. After a user submits their text I want the submit button disabled for 1 second. This is for a chat room to prevent flooding.


PHP Code:



// ----- POST CHAT MESSAGE *CLICK* - START

postMessage_btn.addEventListener(MouseEvent.MOUSE_UP,postMessage);

function postMessage(anEvent:MouseEvent):void {
    if (messageInput.text!="") {

        var request:URLRequest = new URLRequest("http://www.mysite.com/postmessage.php?nocache=" + (Math.random()));

        var variables:URLVariables = new URLVariables();
        variables.usr=x_username;
        variables.msg=messageInput.text;

        request.data=variables;
        request.method=URLRequestMethod.POST;

        sendToURL(request);
        // EMPTY TEXT INPUT AFTER POSTING MESSAGE
        messageInput.text="";
        // FOCUS CURSOR TO TEXT INPUT BOX AFTER POSTING MESSAGE
        stage.focus=messageInput;

    }
}

// ----- POST CHAT MESSAGE *CLICK* - END


// ----- POST CHAT MESSAGE *ENTER KEY* - START

messageInput.addEventListener(KeyboardEvent.KEY_DOWN, enterKeyPostMessage);

function enterKeyPostMessage(event:KeyboardEvent):void {
    if (messageInput.text!="") {
        if (event.keyCode==13) {
            var request:URLRequest = new URLRequest("http://www.mysite.com/postmessage.php?nocache=" + (Math.random()));

            var variables:URLVariables = new URLVariables();
            variables.usr=x_username;
            variables.msg=messageInput.text;

            request.data=variables;
            request.method=URLRequestMethod.POST;

            sendToURL(request);
            // EMPTY TEXT INPUT AFTER POSTING MESSAGE
            messageInput.text="";
            // FOCUS CURSOR TO TEXT INPUT BOX AFTER POSTING MESSAGE
            stage.focus=messageInput;
        }
    }
}

// ----- POST CHAT MESSAGE *ENTER KEY* - END

Disable Button After Click
Hi guys, Im just doing a simple multichoice quiz and my question is this...

is it possible, that after the user has clicked on one of the buttons, that i can disable their function. I want to make them still visable, but not allow the user to click on it.

Thanks in advance...

Lee

Disable Button After 1 Click And...
Hello,

I am making 2 complex buttons
here is swf http://geocities.com/dutch_delusion/btn.swf

so question is: i want to disable button1 after 1 click. after that when click
button2 return and enable button1. and conversely

note: i will use this for 5 buttons in my new design...

i wait u.

thx fly to all prof & friends

Button Disable From Click
i create a button using an image, i want to make the button to be click on first time only, inside the button there is a action script running a loop to generate some animation.

how do i make the button to be run for the first time the user click on the button? the second time the user click, the script will not be run, any idea , thanks

Disable Button After Click
Hello

I have made a simpel text menu. The buttons are being created from an array and then placed on the stage by looping through. It all works just fint, but i dont want the user to be able to click twice at a link. I want to disable the link after clicken. I am totally lost so it would be nice if some one could help!

This is my code for the menu.


Code:
public function addMenuTxt() {

var _menuItem:Array = new Array("WEB","DIGITAL ART","3D MODELING","IDENTITY","PRINT");
var currentWidth:int = 30;
var spacing:int = 30;
var activeBtn:Number;

_txtFormat = new TextFormat();
_txtFormat.font = "Univers LT 57 Condensed";
_txtFormat.color = 0xFFFFFF;
_txtFormat.size = 11;

for (var i=0; i<_menuItem.length; i++) {

var item = _menuItem[i];

trace(i);
_menu = new MovieClip();
_txt = new TextField();
_txt.selectable = false;
_txt.embedFonts = true;
_txt.antiAliasType = AntiAliasType.ADVANCED;
_menu.addChild(_txt);
_txt.defaultTextFormat = _txtFormat;
_txt.autoSize = TextFieldAutoSize.LEFT;
_txt.text = item;
_menu.addChild(_txt);
_menu.data = item;

_menu.x = currentWidth;
currentWidth += _menu.width + spacing;
_menu.y = 161;
_menu.alpha = 0;
addChild(_menu);
_menu.mouseChildren = false;

var interval = i*0.2;
TweenLite.to(_menu, 1, {alpha:1, delay:interval});

_menu.addEventListener(MouseEvent.CLICK, onClick);
_menu.addEventListener(MouseEvent.ROLL_OUT, onOut);
_menu.addEventListener(MouseEvent.ROLL_OVER, onOver);
_menu.buttonMode = true;
}
}

public function onClick(evt:MouseEvent){
menuString=evt.target.data;
var _contentLoader:contentLoader = new contentLoader(menuString);
addChild(_contentLoader);
}


public function onOut(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0xFFFFFF}});
}

public function onOver(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0x00dadd}});
}

Disable Button After Click
Hello

I have made a simpel text menu. The buttons are being created from an array and then placed on the stage by looping through. It all works just fint, but i dont want the user to be able to click twice and load the content twice. Here is an example of an menu

LINK 1 | LINK 2 | LINK 3

If the user clicks the LINK 1 button i want it to disable to the content cant be loaded twice. If the user clicks LINK 2 i want LINK 1 to be able again, and then disable LINK 2.

This is my code for the menu.

[flash=]
public function addMenuTxt() {

var _menuItem:Array = new Array("WEB","DIGITAL ART","3D MODELING","IDENTITY","PRINT");
var currentWidth:int = 30;
var spacing:int = 30;
var activeBtn:Number;

_txtFormat = new TextFormat();
_txtFormat.font = "Univers LT 57 Condensed";
_txtFormat.color = 0xFFFFFF;
_txtFormat.size = 11;

for (var i=0; i<_menuItem.length; i++) {

var item = _menuItem[i];

trace(i);
_menu = new MovieClip();
_txt = new TextField();
_txt.selectable = false;
_txt.embedFonts = true;
_txt.antiAliasType = AntiAliasType.ADVANCED;
_menu.addChild(_txt);
_txt.defaultTextFormat = _txtFormat;
_txt.autoSize = TextFieldAutoSize.LEFT;
_txt.text = item;
_menu.addChild(_txt);
_menu.data = item;

_menu.x = currentWidth;
currentWidth += _menu.width + spacing;
_menu.y = 161;
_menu.alpha = 0;
addChild(_menu);
_menu.mouseChildren = false;

var interval = i*0.2;
TweenLite.to(_menu, 1, {alpha:1, delay:interval});

_menu.addEventListener(MouseEvent.CLICK, onClick);
_menu.addEventListener(MouseEvent.ROLL_OUT, onOut);
_menu.addEventListener(MouseEvent.ROLL_OVER, onOver);
_menu.buttonMode = true;
}
}

public function onClick(evt:MouseEvent){
menuString=evt.target.data;
var _contentLoader:contentLoader = new contentLoader(menuString);
addChild(_contentLoader);
}


public function onOut(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0xFFFFFF}});
}

public function onOver(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0x00dadd}});
}
[/flash]

How Can Disable A Button When I Click It After The Frame?
I have 3 button A,B,C in frame1. When I press the Button A, it can go to frame 2. After the frame2, user will back to frame1 that they can press button B or C. But I want to disable the button A when user click it.

how can I do?

Thanks

Disable A Button For 1.5 Seconds After Click?
Can anyone help me out with this?

I need to disable a button for 1.5seconds after it has been clicked!

thanks

How To Disable A Button/action After A Single Click?
So what im trying to do is have a few buttons that when pressed go to and play a movie symbol at keyframes throughout the timeline.

Say there was a picture of a man, and you click button A and the picture zooms in on the mans head, button B zooms in on his hand and button C zooms in on his foot.
I have all the motion tweening setup and all the buttons work via AS3 using gotoandplay, and there is a stop at each step of the way.

Thats all fine, it works perfectly, however the only issue I have is, say you click button A it plays the part that zooms in on his head, but if you click A again buring the tween/playback it goes back and starts playing again.
Basically what im after, is once you click a button, it becomes no longer clickable untill it gets to next step.
I can disable the button symbol itself using the buttonA.enabled=false; but as the script is on a seperate layer, that doesnt do anything at all. It just stops the button from being a button.. the area ist sitll clickable due to the script. And you cant put scripts within the buttons themselves.

The script im using is
menubutton1.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
gotoAndPlay(2);
}
);

So is there anyway of disabling the gotoand play function between the keyframes. So that if the button is clicked during the tween/playback it doesnt do anything?
I have tried putting a script on the next frame, that doesnt have the gotoandplay portion but that didnt do anything.

(sorry thats a right mess, hope it all makes sense.)

<edit>
I have tried what is mentioned here..http://board.flashkit.com/board/showthread.php?t=766152
But it doesnt seem to be working, perhaps im not putting in the script right or putting it in the wrong spot. As the buttin is still perfectly clickable.

I have keyframe every 15 frames, which has action script in it. to control what the buttons do on that frame.

Onrollout Of Button, Disable Mouse Click
I have a button
on(rollOut)
{
trace("You rollded out");
}
There are many more buttons beside this button. What I want is the moment he rolls out of this button, mouse/cursor should be disabled(although visible) so that he is not able to do anything with other buttons.
There are lots of buttons so I cant use btn.enabled=false
Possible?
Thanks

Got A Movieclip Prototype Playback, But Need A Button Disable After Click
peepz,

i have got a script that dynamicly creates buttons,

but i need to disable the button after clikcing it, i got that working (not in this script) ,but the buttons has a rollover effect, so if i disable it it won't rollout any more.

can somebody make it work ?
code:
stop();

this._parent.mcSubmenuItem._visible = false;

_global.subMenuItems = ["Privacy Policy", "Terms of use"];

MovieClip.prototype.playBack = function(goTo){
this.onEnterFrame = function(){
if(this._currentframe == goTo){
this.onEnterFrame = null;

}else{
this.prevFrame() ;
this.enabled = true;
}
}
}

for(i=0; i<subMenuItems.length; i++)
{
temp_mc = this._parent.mcSubmenuItem.duplicateMovieClip("con tainer"+i, i);
temp_mc._y = this._parent.mcSubmenuItem._y+(17*i)

temp_mc.mcTextAll.mcTextHolder.txtMenuName.text = subMenuItems[i];
temp_mc.cur_i = i;


//set first item selected!!!
if(i==0){

if(temp_mc.pressed){
temp_mc.mcTextAll.playBack(1);
temp_mc.pressed = false;

}else{

if(currentBtn){
currentBtn.pressed = false;
currentBtn.mcTextAll.playBack(1);
}

currentBtn = temp_mc;
temp_mc.pressed = true;


}
temp_mc.mcTextAll.gotoAndPlay(11);

temp_mc.enabled = false;
temp_mc.useHandCursor = false;

//temp_mc.mcTextAll.gotoAndPlay(2);
//temp_mc.mcTextAll.mcTextHolder.txtMenuName.textCol or = 0xFF9900;
//trace("ja");
}


temp_mc.onRollOver = function(){
this.gotoAndPlay(2);
}
temp_mc.onRollOut = temp_mc.onReleaseOutside = function(){
this.gotoAndPlay(12);
}
temp_mc.onRelease = function(){

trace(currentBtn);

currentBtn.enabled = true;
currentBtn.useHandCursor = true;

_global.gtFramelabel = this.cur_i;

if(this.pressed){
this.mcTextAll.playBack(1);
this.pressed = false;
}else{

if(currentBtn){
currentBtn.pressed = false;
currentBtn.mcTextAll.playBack(1);
}
this.mcTextAll.gotoAndPlay(2);
currentBtn = this;
this.pressed = true;


this._parent.gotoAndPlay(2);
}

}
}

Got A Movieclip Prototype Playback, But Need A Button Disable After Click
peepz,

i have got a script that dynamicly creates buttons,

but i need to disable the button after clikcing it, i got that working (not in this script) ,but the buttons has a rollover effect, so if i disable it it won't rollout any more.

can somebody make it work ?

ActionScript Code:
stop();

this._parent.mcSubmenuItem._visible = false;

_global.subMenuItems = ["Privacy Policy", "Terms of use"];

MovieClip.prototype.playBack = function(goTo){
     this.onEnterFrame = function(){
          if(this._currentframe == goTo){
              this.onEnterFrame = null;
           
            }else{
                this.prevFrame() ;
                this.enabled = true;
            }
     }
}

for(i=0; i<subMenuItems.length; i++)
      {  
        temp_mc = this._parent.mcSubmenuItem.duplicateMovieClip("container"+i, i);
        temp_mc._y = this._parent.mcSubmenuItem._y+(17*i)

        temp_mc.mcTextAll.mcTextHolder.txtMenuName.text = subMenuItems[i];
        temp_mc.cur_i = i;
       
       
                          //set first item selected!!!
                          if(i==0){
                           
            if(temp_mc.pressed){
                temp_mc.mcTextAll.playBack(1);
                temp_mc.pressed = false;
                   
            }else{
                  
            if(currentBtn){
                currentBtn.pressed = false;
                currentBtn.mcTextAll.playBack(1);
            }
           
            currentBtn = temp_mc;
            temp_mc.pressed = true;
           
           
            }
            temp_mc.mcTextAll.gotoAndPlay(11);
           
            temp_mc.enabled = false;
            temp_mc.useHandCursor = false;
                       
            //temp_mc.mcTextAll.gotoAndPlay(2);
             //temp_mc.mcTextAll.mcTextHolder.txtMenuName.textColor = 0xFF9900;
              //trace("ja");
        }
   
      
        temp_mc.onRollOver = function(){
            this.gotoAndPlay(2);
        }
        temp_mc.onRollOut = temp_mc.onReleaseOutside = function(){
            this.gotoAndPlay(12);
        }
        temp_mc.onRelease = function(){
           
            trace(currentBtn);
           
            currentBtn.enabled = true;
            currentBtn.useHandCursor = true;
           
            _global.gtFramelabel = this.cur_i;
                   
            if(this.pressed){
                this.mcTextAll.playBack(1);
                this.pressed = false;
            }else{
                              
            if(currentBtn){
                currentBtn.pressed = false;
                currentBtn.mcTextAll.playBack(1);
            }
            this.mcTextAll.gotoAndPlay(2);
            currentBtn = this;
            this.pressed = true;
                   
           
            this._parent.gotoAndPlay(2);
            }
           
    }
}

Disable Current Button And Re-enable All Other Buttons Upon Click. Not Working?
Hello all,
Have a problem that seems easy but for some reason I just can't get it to work.

Code is provided below:
I have thumbnails generated automatically. On thumbnail click I want the current thumbnail to be disabled and all the others to be enabled. I am able to disable them fine using this.enabled=false, but am a bit lost how to get all the other thumbnails to be enabled.

Iit has to be something fairly simple.

Thanks!


Code:
//////////Thumbnail maker///////////////////////////////
function thumbnailer(k) {
loaded_counter = 0;
total_thumbs = _global.total;
var container = thumbnail_mc.createEmptyMovieClip("th"+k, thumbnail_mc.getNextHighestDepth());
container._visible = false;
container._alpha = 0;
var image = container.createEmptyMovieClip("img", container.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue;
callImage();
clearInterval(_root.container.picture.hold);
this._alpha = 50;
this.enabled = false;
};
target_mc.onRollOver = function() {
this._alpha = 50;
_root.firstSound.start();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
loaded_counter++;
counting_txt = loaded_counter;
if (loaded_counter == total_thumbs) {
main_menu.boton1._visible = false;
main_menu.boton2._visible = false;
grid_maker_01();
}
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k+".img");
}
I created a function that I thought would loop through the thumbnails to enable them all but it doesn't seem to work. Shown below.


Code:
//////////Enable All the Buttons//////////////////////////////////////////
function enableButtons() {
for (var cclip = 0; cclip<=20; cclip++) {
thumbnail_mc.th[cclip].enabled = true;
thumbnail_mc.th[cclip]._alpha = 100;
//trace("thumbnail_mc"+z);
}
}

Disable Right Click(how To Disable 'settings' Item?)
Hi all,
I am trying to disable the standard menu coming on right click.The codes like:
newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
this.menu = newMenu;
It's working but still the 'settings' and 'debugger'(disabled) are coming.Can't we hide
whole the menu or disable the 'settings' item? Please help...

How Too Disable The Right Click
how can i disable the right click in the flash moveplayer so when you right click nothing happens

Disable Right Click
How do you disable the right click so nothing at all comes up?

Disable Right Click
hi,
is there any way to disable the write click menu that pops up when a movie is shown on the web?

Disable Right Click
how do you disable a rightclick so user can not click a head with out going to thru movie navigation when a swf movie is playing in a browser?

thanks a mil

Disable Right Click
How do I disable the right click menu on my flash site?

Thanks!

How To Disable Right Click
I am tring to disable all the option(except the setting option)when I right click on the movie. Meaning there will only be the setting option when I right click on the moive.
Can this be done?

How To Disable Right Click
can any body plz tell me that how to disable the right click from the flash movie.

i have used the FScommand, but it is not working at

fscommand ("showmenu", true);

i have a small movie which i will place on my HTML page. i don't want to use the "menu disabling" property from the Movie setting property.

Plz help me in this regard as soon as possible

Disable Right-Click
How do you disable the right-click menu in Flash 6? The showmenu fscommand doesn't work in the plug-in anymore.

Disable Right Click
How can I disable right click in flash movie???
tnx:-)

Disable Right Click
What is the best method to disable the right click option of a movie

Thanks

Disable Right Click
hi guys,

is there anyway to disable the right click on the .swf files?
not projector, but swf files

Disable Right Click
Whats the code to disable right clicks on flash movies?

Thanks

Disable Right Click
How can I disable right click? And can I make it so that when I do right click on the flash it acts as it would in windows? For anyone familiar w/ LiteStep when you right click you get a menu of options. This is what I am trying to get to when right clicking on the flash. LiteStep example ---> http://www.wincustomize.com/skins.as...y=6&SkinID=227

thx
5N4K3

Disable Right Click
Is it possible to disable Right click of the mouse in Flash If so can anybody be kind enough to post it ! Thanx in advance.

Disable Right Click
Hey,
I know this question gets asked abit. Still couldnt fing anything on the forums on it.

In flash 5 i wish to disable right clicking to prevent people from zooming in on my movie, whats the piece of action script for this?
Anyone ^ ^

Thanks

Disable Right Click?
Im making a really simple game but its really easy to cheat. All you have to do is right click and move you mouse to the other end. Is there anyway i can make it so if you right click it restarts the level? gotoandplay(1) or make it so you cannot right click

Disable Right-Click?
Can you disable the Flash Player's Right-Click "Zoom In" feature with an FS Command or otherwise?

Thanks!

Disable Right Click?
Does anyone know how to Disable the Right Click funtion in Flash? So It is not possible to replay a flash movie when in the browser.

If it is, can it be done in Flash or is done in Java/HTML?

Thank you

Disable Right Click...
Hi,

How do i disable the menu that appears when right mouse button has been hit?

NOTE: I want to completely remove it, "sittings" and "about flash" may not appear...

Thanks...

Disable Right Click
hi,
is there any code that i can add to ny frames to disable the right click menu that shoes on the swf or a message popup like "no right click allowed"

thanx

Disable Right Click
any one know how to write action script to close the menu when we right click in flash? i want to close the menu when right click then load some other event if i detect user right click..
anyone can help me? thanks a lot..

How Can I Disable Right Click?
Hello

Is there any way to disable the right click of the movie?? wanna disable even the "about" and "setting"

thx for the help!!

Gallen

Disable Right Click
Ok i just wanted to know a way to make it so that if you right click it goes to a diffrent scene/frame. I know its possible ive seen someone do it before where if you right clicked it ended the game. Thanks in Advance

Disable Right-click?
Is there a way to totally disable the right-click menu? I've inserted the following:

Stage.showMenu = false;
_global.showRedrawRegions(false);

...which does a pretty good job, but I'm still getting a right-click popup with "Show Redraw Regions" and "Settings". Can the popup be done away with altogether?? Many thanks in advance.

Disable Right Click
any way to disable or change the right click menu?

Disable On Click
my main page has 5 buttons. when it loads, it has nothing. the user should should from the buttons where he wants to go: about, pictures, graphics, webdesign,contact.

i want to disable each button in its own page. for example, when clicked on "about", the about SWF loads but i want the "about" button to be disabled in his page.

same for the rest. i have some mouseover captions also.

i tried the code posted by electrongeek but it didnt work at all.

this is the code on each button:
-----------------------------------------------------------------
on (release) {
_root.contents.loadMovie("about.swf"); //or pictures.swf, ... etc
}
on (rollOver) {
_root.x = 1;
_root.caption.words = "About me";
}
on (rollOut) {
_root.x = 0;
_root.caption.words = " ";
}
-------------------------------------------------------

Right Click Disable?
can ne 1 tell me how i can make it so when the right click is pressed the zoom in/out 100% quality and all that does not show

Disable Right Click
Anyone know how to disable right click in Flash and dreamweaver? (as in on right click the menu will not show)

Right Click Disable
Hi,
i want to disable right click when i ckick on my swf file
i am write java script for it but it is not call when i click on swf file.
i am write following action script

Stage.showMenu = false;
it disable all zoom or other option but not disable setting and about adobe flash
i want to hide all options with above both.
how to disable it.
plz help me.

Disable Right Click
any way to disable or change the right click menu?

Disable Right Click
hi i'm doing an app for preschoolers in mx 2004 and i need to disable right clicking... can nyone help?

To Disable Right Click
How can you disable the richt click so the end-user does not have the options of zooming in or out of the flash movie? help please thank you


Looking To Disable Right Click Of An Swf
can anyone fill me in on how to disable the right click option of an swf. ?

Disable Right Click?
Does anyone know how to disable the right click action on a mouse with javascript?

Copyright © 2005-08 www.BigResource.com, All rights reserved