two buttons with single function

I want to create two buttons for single function and a single button for a function. For example, I click on button1, the display shows "clicked1".

If I clicked on button2, the display shows "clicked2". If I click on button1, and then click button2, it will show that "the two buttons are clicked. However, it does not work in two buttons with single function. What is the problem? Here's the code.

import flash.display.MovieClip;

import flash.events.MouseEvent;

var button1:MovieClip = new Button1();

Button1.x = 200;

Button1.y = 200;

addChild (button1);

var button2:MovieClip = new Button2();

Button2.x = 300;

Button2.y = 250;

addChild (button2);

Button1.addEventListener (MouseEvent.CLICK, onClick);

Button2.addEventListener (MouseEvent.CLICK, onClick2);

var isClicked:Boolean;

var isClicked1:Boolean;

function onClick(evt:MouseEvent):void {}

isClicked = true;

trace ("clicked1");

}

function onClick2(evt:MouseEvent):void {}

isClicked1 = true;

trace ("clicked2");

}

If (isClicked & & isClicked1) {}

trace ("two buttons are clicked");

}

Copy the following code

If (isClicked & isClicked1) {}

trace ("two buttons are clicked");

}

should run WHEN you click on your buttons.  That is to say, place it in a function and call that function when you click on your buttons and after that your Boolean values are updated.  (probably then want to reset these Boolean values in the called function).

Tags: Adobe Animate

Similar Questions

  • How can I change the skin of button with the function arguments?

    Hi guys, I am building a card witch I represent with grid 40 * 26 buttons, now I used to create an action script function that will get a string that contains the name of the folder where I store the data for example skin buttons:

    [Embed("maps/grass/upSkin.jpg")]

    _upSkin: class private var;

    [Embed("maps/grass/overSkin.jpg")]

    _overSkin: class private var;

    [Embed("maps/grass/downSkin.jpg")]

    _downSkin: class private var;

    private void changeMap (): void

    {

    slot: Button = new Button();

    slot.setStyle ("upSkin", test);

    slot.setStyle ("overSkin", _overSkin);

    slot.setStyle ("downSkin", _downSkin);

    }

    That's what I managed to do so far, what I would do is send to changeMap() a string with the path name access, but some how I can't integrate a variables, I'll be glade if you could find a solution for this.

    Here's the link to my site, so you can see what I mean. I'm not always online, but you can try.

    http://gazmanwars.zapto.org/

    * Best discovered ground less 1280 * 960

    You can use the selector of a CSS class rather then type selector you probbably do something similar in your css

    Button {}

    upSkin:

    DownSkin:

    }

    This will apply style on all of the buttons in your application as its happening now so you can use the Selector class more like this

    {.myButtons}

    upSkin:

    DownSkin:

    }

    the grid of buttons that make you can then use this statement

    Var b:Button = new Button()

    'b.styleName =' myButtons

  • Add a button with zoom function

    Hello

    I work on a catalogue of products, and for this we used a professional photographer to take pictures of product. The photos are really nice and they can be zoomed to discern details. Pictures have been inserted in the pdf catalogue, but due to limited space, they are not very detailed.

    Is it possible to add a button or a link with the zoom feature? For example, an icon like a magnifying glass, or simply the word zoom, so when a user clicks on it, it zooms in the game area before an upgraded pre and Center it.

    Sounds quite right fantasy? I think maybe the impossible... but it's worth a try here :)

    Kind regards

    Rudi

    Additionally, to prevent Acrobat inviting you to register, add the following line of code at the end of the script:

    dirty = false;
    

    This means, there is something else in the document, like a form to fill out, which could cause the document legitimately require a backup. In this case, you will need to check the property dirty at the beginning of the script and only false if that's what it was at the beginning. If you need assistance with this, post again.

  • How to separate two buttons with a vertical line

    Hello

    I'm trying to separate the 2 buttons in regions with a vertical line as Button1 . Button2. I intend to use an image of the vertical line for this. I put the image of a vertical line in the images of the workspace. How can I see the line between the buttons. Can I use the new "Image display" item for this purpose. Any input on this would be appreciated.

    Tahnks,
    NAV

    Published by: Navarannan on 07-Sep-2010 05:34

    Yust create a between your buttons display element and put it in the source of this button a pipe:

    |
    

    sign.

    In the attributes of the feature display HTML form elements, you can put

    s tyle="font-weigh t:bold;fon t-size:20px"
    

    or similar, to influence the layout of the sign of the pipe.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • button with double function

    Is there a way to create a button that has a rollover caption?

    I want the user to substitute, the button and the text appears above the button, a bit like a ToolTip and disappear when the user leaves the key... but the button to act like a button (need to navigate to another slide).

    I hope than that maks sense.

    Thanks in advance!

    Hello

    Sure thing. Insert a standard button. Then click on the Options tab.

    Select the legend of suspicion.

    See you soon... Rick

    Useful and practical links

  • Two URLs with GO function

    We have a dashboard ('zuiveren unit') with 2 tabs inside ('algemeen' and "rwzi"). I want to have a url that opens the dashboard in the first tab (algemeen') and another url which directly opens the second tab ('rwzi"). When I read the documentation URL GO only can find information to go directly to the request of individalyy, but not one tab of the dashboard.

    Thanks in advance.

    The URL we use to open the dashboard:
    http://Server36/Analytics/saw.dll?dashboard & _scid = KH-V7VgssC8? Go & NQUser = zvb & NQPassword =

    Hello

    You must add the CheminPortail and Page setting.

    So, it should be similar to this (assuming dashboard Zuiveren unit is stored in the shared folder on the painting of demo environment):

    http://Server36/Analytics/saw.dll?dashboard&PortalPath=/shared/paint+demo/_portal/unit+zuiveren&page=RWZI

    Of course, you also need to add NQUser and NQPassword if you call it outdoor Obi.

    Concerning

  • can perform us two actions with a single button in two clicks, one after the other?

    Mr President.

    can perform us two actions with a single button in two clicks, one after the other?

    I want that when I click on the button Add once it add data to the database and when I click again on this button it clears the form data to the empty fields.

    Concerning

    Tanvir

    In the code, it should be easy.

    The following code adds that a button called butman with text 'ADD '.
    It then registers a listener that will be called if the user clicks the button.

    This listener then calls the runAddData method if you clicked butman while it contained the text of "ADD" and it calls the runClearData method otherwise.
    That's why he will swap the functionality of the button between ADD and CLEAR on each click.

    final Button butman = new Button("ADD");
    butman.setOnAction(new EventHandler() {
              @Override
              public void handle(ActionEvent t) {
                        if (butman.getText().equals("ADD")) {
                                  butman.setText("CLEAR");
                                  runAddData();
                        } else {
                                  butman.setText("ADD");
                                  runClearData();
                        } // END IF-THEN
              }});
    

    I hope that's what you wanted.

    Further reflection.
    You might want to run the ADD and CLEAR methods in their own son so that it can run in the background without slowing down your user interface.

    I also reuse rather a single button for several features instead of to apply with hundreds of nodes used only rarely with masses of code to show and hide as needed.

  • Two actions with a single button Oracle adf

    Hello
    Dear all,
    I want two action with a single button. Before posting, I studied this thread, but it seems that it cannot solve my problem two actions with a single button?
    It's my button and its action http://4.bp.blogspot.com/-tpP5wIW8JLI/T66zhLZgG0I/AAAAAAAAAPY/F1A-Ka8KGPY/s1600/req1.JPG
    getReqID button is actually a call to a procedure that returns a value to his class of action. The cb1_action function is...
    public String cb1_action() {}
    BindingContainer links = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("getReqID");
    Object result = operationBinding.execute ();
    int id = Integer.parseInt (result.toString ());
    System.out.println ("result =" + id);
    If (! operationBinding.getErrors () .isEmpty ()) {}
    Returns a null value.
    }
    Returns a null value.
    }
    It works very well. Don't know I want to, click this button, it also opens a page of .jsff. but I'm unable to open this page.
    Help, please
    Thank you
    Muhammad Nasir

    The first image you provided shows a small 'Attention' sign on the "request for quote-global-TF" which, I guess, gives you the sentence.
    This warning tells you that there is a problem with the task flow that you imported from the pot. Move the mouse over the warning sign a see what message you get from the frame on the error. If you don't get one, in 'source' view and look for red or orange squares in the gutter of the right hand. Scroll to the position of the red square and move the mouse over the underlined part red or orange of the code.

    Timo

  • Formatting text in "function of two button dialog box."

    With monitors high resolution, the text in the Panel that displays the function of two dialog button is often small and difficult to read (at least for these old eyes).  Is it possible to format this text?

    Roy

    You can make your own.

    Make a simple Subvi with two buttons and a text indicator. Make windows style 'dialogue' appearance and add some logic (for example an event structure) to flip the button which was pressed.

  • I try to combine a picture of my sister with a picture of a poem next to her. How to combine the two into a single photo?

    Paint or Windows Photo Gallery

    I try to combine a picture of my sister with a picture of a poem beside it, how to combine the two into a single photo?

    If you have the poem recorded in an image format,
    the following freeware can create a side by side
    Panorama.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Download IrfanView
    http://MajorGeeks.com/IrfanView_d4253.html
    (filename: iview433_setup.exe)
    (uncheck if you don't want Google Chrome)

    Download plug-ins too...

    IrfanView plugins
    http://MajorGeeks.com/IrfanView_PlugIns_d4908.html
    (filename: irfanview_plugins_433_setup.exe)

    When the program is installed... read more...

    Open IrfanView and go... Image / create the Image of the Panorama...
    (this will open the screen to "Create a panorama image")

    On the screen to "Create a panorama image"... left click on the add images"" button.
    (Displays the 'Open' screen. Now, drill down to the
    the folder that contains your saved Photos of veterinarians.

    Now... click left (highlighted), the two images, you want to join.
    (you can select more than one if you hold down your Ctrl key)
     
    The two images highlight... left click on the button 'open '.
    (Or... you can add the images one at a time... which is always easier)

    Now, go back to the screen "Create the panorama image.
    and the file names of the selected pictures need to be in the
    Field "Input Images.

    Now with the names of two files in 'Images of entry' field...
    You can left click on the button 'create Image '.

    (the positions left and right of these images can be swapped in)
    selection of a file name and using the "mount image" / "Move."
    Images down"buttons...)

    Now you should see a display of the combined image.
    Reach... File / save as...

    Choose a backup location / enter a file name / choose a format...
    On the left, click on the button "Save..."

  • Error with the function "Open/create/overwrite file" with cancel button

    I have attached a very simple VI who embodies what I want to do with my function to open the file. I just want to stop the rest of my program (theoretically embedded in the Structure box) to run if the user deigns to do not to specify a file location.

    However, if you click on the button cancel an error is produced before the rest of the program is running. If ignore you the error and continue, the "canceled" properly true made variable and the Structure of business runs correctly. "" I just want to remove the error message given to me by LabVIEW.

    Any ideas on why or how?

    Read the help of LabVIEW on automatic error handling.

    In your case, you can just wire the output of cluster of error to the structure of your business.

  • Whenever I hit the installer and run it, it comes up with a window with two buttons, an asset and a button at home. A small circle rotates around on the screen. Nothing ever happens in addition. I tried it several times redownloading. What sh

    Whenever I hit the installer and run it, it comes up with a window with two buttons, an asset and a button at home. A small circle rotates around on the screen. Nothing ever happens in addition. I tried to re - download several times. What should I do? Here is a picture of what happens:CCFail.PNG

    See if the following can help:

    White screen

    https://forums.Adobe.com/thread/1249756

  • Button with two linked actions. Doesn't work

    My folio I have two buttons (to change the language) I have change the State of the text and the title.

    With a simple TOUCH, she changes two States (two measures).

    In the preview with the Office Viewer that works, but on the ipad isn't (I need two consecutive tap the same button).

    Why?

    I think you came across a weird bug that has not yet been set. In your target MSOs, try to set a Cross Fade with a minimum delay, such as 0.125 seconds. Then it should work.

  • several buttons with very similar functions

    I use the code has a button that adds a MC to step below. The problem is that I have over a dozen of these buttons and I would rather not write the listener of events and the function for every single button. Is there a way to use a single function for all buttons and just change that MC is added based on which button is clicked? So if the user clicks the button draw5 function adds the MC deck5 to the scene?

    var drawnCard:MovieClip

    Draw1.addEventListener (MouseEvent.MOUSE_DOWN, dealTheCard);

    var alreadyDrawn:Boolean = false

    function dealTheCard(event:MouseEvent):void {}

    if (alreadyDrawn == true) {}

    this.removeChild (drawnCard);

    trace ("removed card")

    }

    drawnCard = new deck1();

    alreadyDrawn = true

    addChild (drawnCard);

    drawnCard.x = 60;

    drawnCard.y = 50;

    drawnCard.gotoAndStop (Math.ceil (Math.random () * 11))

    }

    use:

    kglad wrote:

    var drawnCardObj:Object = {};

    var tl:MovieClip =;

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

    TL ['draw' + i] .addEventListener (MouseEvent.MOUSE_DOWN, dealTheCard);

    .Ivar TL ['draw' + i] = i;

    }

    var alreadyDrawn:Boolean = false

    function dealTheCard(event:MouseEvent):void {}

    If (drawnCardObj [MovieClip (event.currentTarget) .ivar]) {}

    tl.removeChild (drawnCardObj [MovieClip (event.currentTarget) .ivar]);

    }

    var classRef: Class = Class (getDefinitionByName ("bridge" + MovieClip(event.curre_ntTarget).ivar));

    var drawnCard: * = new classRef();

    drawnCardObj [MovieClip (event.currentTarget) .ivar] = drawnCard;

    tl.addChild (drawnCard);

    drawnCard.x = 60;

    drawnCard.y = 50;

    drawnCard.gotoAndStop (Math.ceil (Math.random () * 11))

    }

  • How can I associate a button with two slices?

    Hello
    I need help please. How can I associate a button with two slices? or combine the two slices to make one cut or make a form of true polygon on the edges, it will make to the polygon, but it leaves the red lines and I cannot work under this installment... If you understand. Someone help please. Thank you very much.

    Two points.

    First of all, I see that you have forms stars in your image, but that does not mean that you need a star-shaped slice. You can use a little square that is centered on your star. That could make it easier to create your slices. All you have to do is drag lines of leaders in the left seat and superior, two pairs around each star and then drag a slice from one end to the other.

    Noting that brings me to my second point: images must be rectangular. If you want to change the L-shaped area, then you need to swap two images, not one only. This is perhaps why you cannot have the buttons under the threshold of upper sliding of your L shaped section. Because Fireworks needs to make a rectangular image, it is by default in an area that encompasses the range - area you can not the buttons in. It is the lock area non cut which still need to be part of the image, since the part will swap, too.

Maybe you are looking for