Detect if a button is clicked

I'm trying to ensure that if you click on the 5 buttons on my frame homepage you will advance to another frame.  The problem I have is the buttons you click to take you away from the image of home page.  So let's say the home page is frame 1.  1-5 keys take you t images, 2-6, (as part of the main sequence).  I would like to be able to direct the user to page 7, once you click on the 5 buttons, but I'm out of problems with detection if the button has been clicked.  Here is my code with 'main' being the movieclip that everything else is inside.

var clickCount:int = 0;

var clipArray:Array = [main.btn1_mc, main.btn2_mc, main.btn3_mc, main.btn4_mc, main.btn5_mc];

for (var i: int = 0; i < clipArray.length; i ++) {}

clipArray [i] .buttonMode = true;

clipArray [i] .addEventListener (MouseEvent.CLICK, clickHandler);

clipArray [i] .isClicked = false;

}

function clickHandler(event:MouseEvent):void {}

switch (event.currentTarget) {}

case main.btn1_mc:

trace ("btn1");

break;

case main.btn2_mc:

trace ("btn2");

break;

case main.btn3_mc:

trace ("btn3");

break;

case main.btn4_mc:

trace ("btn4");

break;

case main.btn5_mc:

trace ("btn5");

break;

}

clickCount ++;

trace (clickCount);

if(Event.currentTarget.isClicked == false) {}

event.currentTarget.isClicked = true;

}

if(clickCount == clipArray.Length) {}

trace ("all the buttons were clicked");

}

}

Stop();

any help is appreciated as always.  Thank you

Add the following line to the highest level of your fla:

var clickOrigins:Array = [];

function checkArray(_target:String,_arr:Array):Boolean {}

{if (_arr. {(IndexOf (_target) ==-1)}

_arr.push (_target);

Returns true;

}

else {}

trace ("you already clicked that");

Returns false;

}

}

and change to your clickHandler adding to

event must have the same syntax as your ClickHandler argument, so if you wrote the clickHandler(evt:MouseEvent) function... event should be called evt

If ((MovieClip (racine) .checkArray (MovieClip .clickOrigins (root), event. currentTarget.name)))

{

MovieClip (root) .clickcounter ++;

}

If (MovieClip (root) .getClicks ())

{

MovieClip (root).main.gotoAndStop (7);

Empty table if you must use it again:

   // MovieClip (root). clickOrigins = [];

}

on the other

{

Put here the stuff you want to be run regularly

}


Tags: Adobe Animate

Similar Questions

  • How to detect wheather the button is clicked or not and disable if you click

    Guy

    I have 4 button navigation and as the House, are we etc...  And I want to disable the House when there is click and cannot be clicked until the user click on the button another first. means if a visitor's home page then navigation host is disabled and all others are active, and when they click to aboutus button then the pages will to her we are page and the subject we touch is disabled and another get active. I want that this solution in AS3 with oop concept.

    Thank you

    Something like the following...

    function buttonmode(link:MovieClip):void {}

    link.buttonMode = true;

    }

    buttonMode (rec1_mc);

    buttonMode (rec2_mc);

    buttonMode (rec3_mc);

    buttonMode (rec4_mc);

    buttonMode (rec5_mc);

    buttonMode (rec6_mc);

    buttonMode (rec7_mc);

    buttonMode (rec8_mc);

    function enableButtons() {}

    for (var i: uint = 1; i<9;>

    ["rec" + String (i) + "_mc"] .mouseEnabled = true;

    }

    }

    function navigate1(e:MouseEvent):void {}

    navigateToURL (new URLRequest ("http://www.ebpearls.com"), "_self");

    enableButtons();

    e.currentTarget.mouseEnabled = false;

    may: MovieClip (e.currentTarget) .mouseEnabled = false;

    }

    function navigate2(e:MouseEvent):void {}

    trace ("2 button is clicked");

    enableButtons();

    e.currentTarget.mouseEnabled = false;

    may: MovieClip (e.currentTarget) .mouseEnabled = false;

    }

    function navigate3(e:MouseEvent):void {}

    trace ("3 button is clicked");

    enableButtons();

    e.currentTarget.mouseEnabled = false;

    may: MovieClip (e.currentTarget) .mouseEnabled = false;

    }

    function navigate4(e:MouseEvent):void {}

    trace ("4 button is clicked");

    etc...

    }

    function navigate5(e:MouseEvent):void {}

    trace ("5 button is clicked");

    }

    function navigate6(e:MouseEvent):void {}

    trace ("6 button is clicked");

    }

    function navigate7(e:MouseEvent):void {}

    trace ("7 button is clicked");

    }

    function navigate8(e:MouseEvent):void {}

    trace ("8 button is clicked");

    }

    rec1_mc.addEventListener (MouseEvent.Click, navigate1);

    rec2_mc.addEventListener (MouseEvent.Click, Navigate2);

    rec3_mc.addEventListener (MouseEvent.Click, navigate3);

    rec4_mc.addEventListener (MouseEvent.Click, navigate4);

    rec5_mc.addEventListener (MouseEvent.Click, navigate5);

    rec6_mc.addEventListener (MouseEvent.Click, navigate6);

    rec7_mc.addEventListener (MouseEvent.Click, navigate7);

    rec8_mc.addEventListener (MouseEvent.Click, navigate8);

  • I'm new on El Capitan.  Window, emerged that says 994 issues found with a button to click to start the repair.  What is a legit Apple window?

    I'm new on El Capitan.  An arisen window that says 994 found subjects (files duplicated, System & unwanted internet, recoverable unauthorized software & disk space) with a button to click to start the repair.  What is a legit Apple window?

    Not enough information. Please be more complete. It would also help if you can provide a screenshot of this:

    To post a screenshot

    1. Press command + shift + 4, that will change the cursor to the line of sight.
    2. Hold down the mouse button and the collimator allows you to select the part of the screen you want to capture.
    3. Release the mouse button and the image will be saved on your desktop.
    4. Click on the camera icon in the toolbar of the message forum Editor.
    5. Drag the image on the button select a file and click the Insert button.
  • How to uninstall service pack 3, which was not properly installed? There is no button to click to repair remove__or in the add and remove software. Is to play other software, I need it out of my computer__thank - you

    My janome digitizer software does not work properly.  JANOME said to uninstall microsoft service pack 3
    I went to control panel, add or remove software.  service pack 3 is here, but I can't remove it because there is no button to click on delete.  Help, how to remove, uninstall this service Pack 3?  Thanks for your help.

    How to remove Windows XP Service Pack 3 from your computer
    http://support.Microsoft.com/kb/950249

    Unfortunately, now it can create more problems removing it because there have been many updates since SP3.

    TaurArian [MVP] 2005-2010 - Update Services

  • How to change the label of the button by clicking on it. ?

    Hello

    I'm changing the label of a button by clicking on it. and want that persist until another click.

    How can I do it.

    Please help and give detailed information.

    Thank you and best regards,

    Narendra shekhawat.

    crush navigationclick in class buttonfield and setLabel allows you to set a different text

  • Cursor selects and/or open things without a press of button or click simply by being put near something selectable

    Original title: after upgrading to Windows 7 from Vista cursor selects and/or open things without a press of button or clicks simply by being put near something selectable. Help, please!

    Recently upgraded my gateway from Vista to Windows 7. Now the cursor selects often things it is nearby or pass and the computer was faster at the beginning but now it can be slow to load pages, etc.  It is terrible and has caused at least one major and made problems a horror to use my laptop.

    WTF?

    Hello damatriarch06,

    You are welcome. It is what we are trying to do... help people! Thanks for letting me know that the problem is solved.

    Kind regards

    BearPup

  • Define a cutting-edge Action playing audio wrap-up after all the buttons are clicked

    Hello

    I think I know the answer to my problem, but it seems not work once I pick up the pieces. I want the learner to click the 4 buttons and listening to their audio every, and then hear an audio wrap-up before moving on to the next slide.

    Here's how I think it is supposed to work:

    Drag the details: I have 4 buttons (R, A, C, E) for a 4-step process. Each button is clicked to reveal a text box, retail and the sound for each step. As soon as the user clicks on all 4 buttons I want an audio recap to play.

    Program information: I created a variable with a value of 0 for each button (Aviewed, Cviewed, Rviewed Eviewed). Then created a tip for each button action: (when R button, assign Rviewed with a text box 1 and see the Rdetails) for each letter. Thus, on the success of each button action advanced.

    Then I created another Action of the art called AudioExitSlide #. It is a conditional action that says that when all 4 variables have a 1 piece, theatre wrap up audio, ___not thing other than what to put here (continue and break doesn't seem to work). I don't know where else to mark this advanced action but the action on Exit.

    When I preview the slide, I never heard my audio recap. What I'm doing wrong here?

    Help, please.

    Yacine

    Will try to explain it, but first want to have a confirmation:

    • The audio is attached to the text caption that is displayed when you click a button? You have a problems with multiple audio clips playing at the same time, if the user clicks on the buttons for quickly, all at once?
    • What version do you use?

    The event on the output is never trust, it will execute your action after leaving the last image of the slide, and since then you are at the beginning of the next slide!

    I would also like to see a screenshot of your calendar, please? Here's a few tips:

    1. You must check the variables with each pressing of the button, which means that you will need a conditional action with two decisions:

      1. First decision 'Always' go do what you have now in the standard measurement using a standard simulated action like this:
        IF 1 is equal to 1
        Assign v_R with 1 sorry, I'm always variable v_ to avoid assigning the same name to something
           
        See the Tx_A
        Play Audio_A I prefer to use this command on an object, audio because you never have two clips playing simultaneously
      2. Second decision "WrapCheck" will check the variables
        IF EV is equal to 1 AND
        v_A is equal to 1 AND
        YaeUb is equal to 1 AND
        v_C is equal to 1
        ????    will tell you what to do here after answering my questions
  • release button right-click another?

    Hi all

    I'm quite new to livecycle and I have almost completed my form with the exception of one: button click.

    I currently have my doc 15 page separated into sections that can be expanded or reduced when a '+' or '-' you click on the button. (I chose to hide all items by default, because the items that will be displayed depend on criteria selected in the menu dropdown 1 and drop-down menu 2)

    To make it easier for users. I created a button "Expandall", but now I had to make it work.

    Now, when my "expandall" button is clicked I need to trigger the action of my 'Guide' button (which will be display all lines in this section)

    Yes, onclick to ' expand all, click 'guide "?

    I don't know it's probably very easy to do, butI am puzzled.

    Help, please.

    Thank you very much.

    Okay, so I post on that topic and 5 seconds later I fgiure out... How simple:

    I added this script in the button "expandall": scipt Editor

    Subform1.table2.Row12.Guide.execEvent ("Click");

    .. I can simply add the rest of the buttons... (phew)

  • How to cancel my subscription to Adobe? I am charged every month and I do not really use it enough to justify. I followed the instructions of tine for how to cancel at least, but it does not give me the "Cancel" button to click.

    I am charged every month and I do not really use it enough to justify. I followed the instructions of tine for how to cancel at least, but it does not give me the "Cancel" button to click.

    Cancel https://helpx.adobe.com/creative-cloud/help/cancel-membership.html

    -or https://helpx.adobe.com/contact.html?step=ZNA_account-payment-orders_stillNeedHelp

  • Is it possible to create a standard form which can be sent by email to anyone and once filled by the receiver, have a button that clicks on the receiver and the form is encrypted and attached it would open up an email to the sender and a built-in admin pa

    Is it possible to create a standard form which can be sent by email to anyone and once filled by the receiver, have a button that clicks on the receiver and the form is encrypted and attached to an e-mail to the sender and a built-in admin password it open?

    Hello Graphicsguy123,

    You can get the workflow above using the Widget feature. Here is the link for reference:

    https://helpx.Adobe.com/document-cloud/help/create-widgets.html

    -Usman

  • Advanced action scripts - y at - it a variable that tells me which button is clicked?

    Lilybiri gave me some great tips on the use of conditional tip action scripts. Now, I have another related question.

    I have three buttons A, B and C. Each button performs exactly the same series of actions to hide everything on the page, but shows another group of objects depending on which button was clicked - that is, to display the Group A and Group B group C.

    Currently, I have a separate advanced action script for each button (in fact a lot more than three) because of this difference, then want to combine in a single conditional script. However, I can't understand how I would like to know which button was clicked.  In other words, I think that my conditional script should look like this:

    The condition "always."

    If 1 is equal to 1

    [Script to hide all]...

    Continue

    Condition 'has '.

    If MyButton is equal to 'A '.

    See the group_A

    On the other

    Continue

    Condition 'B '.

    If MyButton is equal to 'B '.

    See the group_B

    On the other

    Continue

    Condition 'C '.

    If MyButton is equal to 'C '.

    See the group_C

    My problem is that I don't know how to set or get the value of MyButton to perform conditional tests. Is there a system variable that returns the value of a selected object? I looked at all the variables, and I don't see one. Or y at - it another way to do what I'm missing?

    You probably can find with Javascript, but not with advanced actions. All the available system variables that can be used - there are more - are in a table that you can download here: System variables in Captivate 8 - Captivate blog

    I have several articles on the shared use of stocks. You apply the same instance of a common action several times and don't have that to indicate parameters, in your case these parameters will be for most groups and objects. I hope that stocks shared will expand more in the future. They have several advantages: given that you use multiple instances of the same action that they do not increase the file size as duplicate advanced actions. In addition, you have them in the library that makes management much easier.

  • need to put a download in report page button and clicking on it, only few columns will download (only specified)

    Hello

    I need as I put a download in report page button and clicking it will download only few columns (only specified). I use Apex 4.2.

    Please give an idea.

    Thank you

    Chebli

    Action-> download-> when you click the CSV, it will send a request like "CSV". Change the columns that you want to include in the output csv file. Go to the Condition section,

    Condition type: request is NOT contained in the Expression 1

    Expression1: CSV

    This column will not include in the csv file.

    Thank you

    Lacombe

  • You can use actionscript to detect if an icon was clicked in your Flash Web site?

    I want to make my icons lights or vibrating, if they were clicked.  If the viewer clicks on the icon, they watch a video clip and then be returned to the main screen with icons of palpitation.  Is it possible for Flash detect if this icon was clicked when they clicked on the icon to return to the main screen can stop throbbing?

    ?  I am sure that it is not possible with the timeline.  Any help would be appreciated as always

    This configuration is problematic.  use a swf file of a frame that contains your movieclips icon only.  assign the icon movieclips instance like icon1_mc, icon2_mc etc. names.  Add a flvplayback in your library component.

    You can then use:

    var flv_pb:FLVPlayBack = new FLVPlayBack();

    flv_pb.addEventListener (Event.Complete, completeF);

    function completeF(e:Event):void {}

    removeChild (flv_pb);

    }

    var gf: GlowFilter = new GlowFilter();

    var previouslyClickedIcon:MovieClip;

    var iconA:Array = [icon1_mc, icon2_mc, etc...];

    var flvA:Array = ['flv associated with icon1.flv', 'icon2.flv', etc...];

    for (var i: int = 0; i<>

    iconA [i] .addEventListener (MouseEvent.CLICK, clickF);

    }

    function clickF(e:MouseEvent):void {}

    {if (previouslyClickedIcon)}

    [from = previouselyClickedIcon.filters];

    }

    MovieClip (e.currentTarget) .filters = [gf];

    addChild (flv_pb);

    position flv_pb

    flv_pb.source = flvA [iconA.indexOf (e.currentTarget)];

    }

  • How can I get audio to not start when the button is clicked?

    I am new to adding audio to slides, buttons, click boxes.  Import the recorded voice on the overall slide of files sounds easy enough.  However, there are several buttons that display a legend I want audio to not start when the button is clicked.  I added audio just for this button, but it starts when the slide begins.

    How can I get audio to not start when the button is clicked?

    Hello

    Audio playback when the assigned object with the audio appears. That's why hear you when the button appears.

    Try to assign audio instead to the object that is displayed when you click the button. Perhaps the legend.

    See you soon... Rick

    Useful and practical links

    Captivate wish form/Bug report form

    Certified Adobe Captivate training

    SorcerStone blog

    Captivate eBooks

  • Captivate 4 - button or click on the boxes to return to a previous slide

    Hello

    In the project I do in Captivate 4 I want on the last slide to have a list of topics and for users to be able to click on each one to return to an earlier point in the project as a re - cap on these subjects.

    I tried to do this with the two buttons to text, then click on boxes and it just doesn't work and I can't work out why. In each case (i.e. with the option button and click on box), I chose «Jump to slide...» "but when I saw and click in the area concerned, the project does not move. There is something which is the last slide or Captivate will only allow you to advance to no return?

    I can't really work on why it does not work.

    Can anyone help?

    Thanks in advance.

    Most likely, the problem is that you are previewing your project using F8. This only "will make" a couple of slides so jump all actions will not work correctly.

    Republish your project and see if the links do not work now.

    / Michael

    Visit my Captivate blog with tips & tricks, tutorials and widgets.

Maybe you are looking for

  • Set up Sync does nothing

    When I click on the Menu option "Configure synchronization" menu item disappears, as expected, but does absolutely nothing else. Also, if in the Synchronization Options window tab, I click on login or create an account, the window disappears and noth

  • Return to the display of the old images

    I've just updated to Firefox 11 and the new view of the image is horrible. When I go to a URL of the image (like this http://www.google.com.br/images/srpr/logo3w.png ), it is displayed with a dark background. It would be best that the background was

  • New HDD in Tecra 8100 (500 mhz)

    Anyone know if one of the hard disk for Toshiba laptop is compatible with the Tecra 8100 pentium 3 (500 mhz)? I'm looking for the reader more fast/capacity for the execution of programs like Cubase 5.1, Cubase SX 1, 2 music sequencing, Sibelius etc.

  • Playing a disc error has occurred

    I use hp compack cq42... suddenly, I have on my laptop and the laptop then tell a disk read error occurred

  • Re: Ethernet Port work is not on the P077TX Pavilion

    This is the driver you are looking for http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-137996-1&cc=us&DLC=en&LC=en...