Wait For A Button Press

Hey, I am currently creating a game and need to know how to wait for a certain button to be pressed. A popup message comes up that tells the user to press a button, then I need to wait for the button to be pressed. Then once the button is pressed, I want another message to come up. The problem is, I have no idea how to wait for a button press after the first message comes up. Instead it just displays the first message, then the second directly after.
Thanks

So you have a button that is always present. Normally clicking the button does nothing. But sometimes a message shows up, in which case if the user clicks the button, something happens. Right?
UI principles aside (it's bad form to display a button that does nothing), this is pretty simple.
Create a field to track whether the button does anything. For example:
private boolean buttonActive = false;In your action listener for that button, first check the value:
public void actionPerformed(ActionEvent e) {
    if (buttonActive) {
        // do your thing
}If the buttonActive is true, it does something, otherwise it does nothing.
After you display the message, set buttonActive to true. When you want the button to become a brick again, set it to false.

Similar Messages

  • Trying to wait for a button press on a seperate JFrame- problems.

    Hi,
    I've been getting aquainted with Java recently. I'd like to think I was reasonable now at creating console based applications but I'm having a lot of trouble getting used to the swing API. I'm making a little game type thing at the moment and part of it involves displaying a problem to the user in a seperate JFrame and returning which option they picked. If I was doing this in a console based App I'd probably do something along the lines of:
         while (UserInput == null) { //while they haven't entered anything continue to loop.
              UserInput = InputScanner.next(); //get the user's input
         }I thought I'd do something similar for my JFrame based app but haven't been able to do it. I essentially would like the code to not execute past a certain point until one of the options on the JFrame has been picked. Here's the code for the JFrame showing the dilemma to the user:
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    * This is the window displayed to a user with dilemma details
    public class DilemmaWindow extends JFrame implements ActionListener {
        int OptionPicked = 0; //the option the user picks
        JLabel DescriptionLabel;
        JButton Button1;
        JButton Button2;
        public DilemmaWindow(String WindowTitle, String LabelText, String Button1Text, String Button2Text) {
            //construct the JFrame with the relevant parameters
            setTitle(WindowTitle);
            setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
            setLayout(new FlowLayout(FlowLayout.CENTER));
            Button1 = new JButton(Button1Text);
            Button2 = new JButton(Button2Text);
            Button1.addActionListener(this);
            Button2.addActionListener(this);
            DescriptionLabel = new JLabel();
            DescriptionLabel.setText(LabelText);
            add(DescriptionLabel);
            add(Button1);
            add(Button2);
            pack();
            setVisible(true);
        public void actionPerformed(ActionEvent evt) {
            //determine which button was clicked and set OptionPicked accordingly
            if(evt.getSource() == Button1) {
                OptionPicked = 1;
            } else {
                OptionPicked = 2;
        public int GetDilemmaChoice() {
            if (OptionPicked > 0) { //if an option was picked
            this.dispose(); //clean up the window
            return OptionPicked; //return which option was picked
    }The idea of this being that it constructs a window and when the GetDilemmaChoice() function is called it'll return which button has been clicked.
    I do, as I said, want to wait until one of the buttons has been clicked before continuing with the execution of the code in the class that constructs the JFrame, so I made the following function:
    public int GetDilemmaChoice() {
            int Choice = 0;
            DilemmaWindow MyDilemmaWindow = new DilemmaWindow(CaperDilemma.GetDilemmaName(),CaperDilemma.GetDilemmaDescription(),CaperDilemma.GetOption1Text(),CaperDilemma.GetOption2Text());
            while (Choice == 0) {
                Choice = MyDilemmaWindow.GetDilemmaChoice();      
            return Choice;
        }The idea being that while the window returns that no buttons have been clicked the function loops round. The problem I'm having is that the while loop continually looping seems to hog all the CPU time or something, as the dilemma JFrame doesn't display properly (I get a blank window, with none of the buttons) and so I can't click any of the options. I've been banging my head against a brick wall all day trying to get round this and am wondering if I should put the looping in a seperate thread or something. Sadly, though, I don't know anything about threads so wouldn't know where to start.
    If anyone has any idea of how to solve this problem I'd be very grateful! I hope I've managed to explain it well enough.

    Why not use a modal JDialog here and not a JFrame. You probably shouldn't be coding directly to a JFrame (or JDialog) anyway but to a JPanel that can be placed on the proper root container of choice (which again here is a JDialog). You can make your JPanel as complex as desired, then place it in the JDialog, make that dialog application modal, and when you show it via setVisible(true), the application will halt at that point until the dialog has been dealt with.

  • Wait for a button click

    Hi,
    Here's the problem :
    my main class calls :
    LoginContext loginContext = new LoginContext("Main",
    new DialogCallbackHandler());
    I've made a DialogCallbackHandler class which opens a JFrame with 2 fields (TextField & PasswordField) and a button "ok".
    But the LoginContext wants immediately an answer (the login & the password). How can I make the loginContext waiting for the button click.
    I tried with a
    while(!buttonClicked);
    but it's not a good solution.
    I also tried with a Thread inside this loop while and sleeps (during a 500 ms). But I think there's a better solution...
    Can I make a wait, and a notify for this or not.
    Thank you for your help.
    Yann
    -- http://www.objectweb.org/jonas

    Why don't you use the JOptionPane class.
    I think it provides all that you need.
    For example use the method :
         String pass = "azedvge";
         JPasswordField passwordField = new JPasswordField(20);
         int result = JOptionPane.showConfirmDialog(parentComponent, password, "Password check", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
         if (result == JOptionPane.OK_OPTION) {
              String p = new String(passwordField.getPassword());
              if (p.equals(pass)) {
                   // OK !
              else {
                   System.exit(0);
         else {
              System.exit(0);
    I hope this helps,
    Denis

  • Wait for user to press ok in JFrame

    I have two windows the main one is for setting configuration values.
    the second is for one of the config values that is a list and i have made a JFrame that has the list and can remove and add things to it.
    it also has a OK button for when the user has finished and a function to convert the list into a string i can store in my config file.
    what i dont know how to do is make the main window wait until OK is press on the second window
    then it needs to get the string with the list in it.
    if you have some code or a tutorial you could point me towards that would be great.
    Scott.

    1) don't use a second JFrame, use a modal JDialog as this is precisely what it is built to do.
    2) Have the class that produces the JDialog's components also have a public getter method(s) to extract what you want from the dialog once it has been closed.
    3) Search the forum for examples. you'll find lots, many helpful.

  • Delete Record Behavior doesn't wait for Submit button

    I have master / detail page set.  From the detail set there are links to delete or update a record.  When I click the link to delete the record, it goes to the   confirmation page with the correct record.  Now, when I add the delete record server behavior and a submit button, this is what happens.  As soon as I click the link to go to the delete confirm page, the record deletes and the page redirects to the page I put in the server behavior.  It doesn't show the confirm page and doesn't wait for me to hit the confirm button.  The page runs and successfully deletes the page from the DB.
    How do I get it to wait until I hit the submit button?

    You need to surround your delete query with an "If" statement that checks for a confirmation variable of some sort, then when the user clicks the confirmation link you can pass the necessary variable and the ID of the record the delete query is expecting.
    As an alternative you could use a JS alert fuction to ask the user if they are sure they want to delete the record and then allwo the delet to run after confirmation. To do this you could use code like this...
    <input type="submit" name="DELETE" value="DELETE"
       onclick="return confirm('Are you SURE you want to DELETE this record?')">
    Lawrence   *Adobe Community Expert*
    www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in ASP, PHP and CF
    www.twitter.com/LawrenceCramer

  • Dynamic Action with KeyCode check for ENTER button pressed

    Hi,
    I want to create a dynamic action which executes if the ENTER button of field P1_NAME is pressed.
    I thought about this type of DA:
    Event: Key Press
    Selection Type: Item(s)
    Item(s): P1_NAME
    Condition: Javascript expression
    Value: this.triggeringElement.keyCode == 13
    That unfortunately doesn't work! Dynamic action doesn't get executed...
    Hope for help! :)
    Tobias

    I found the solution in my own blog: :)
    Event: Key Press
    Selection Type: Item(s)
    Item(s): P1_NAME
    Condition: Javascript expression
    Value: this.browserEvent.keyCode == 13

  • Captivate 8 - I want my slides to stop at the end and wait for a button click to advance

    It works when published as HTML5, but NOT as swf.
    (I have those specific slides set to pause at the end.  They contain stuff the user might want to write down.)
    Instead, the swf project advances to the next slide and THEN stops.  Instead of using the forward button, the user has to use the play button on the skin.
    Any help would be greatly appreciated!

    I suppose you used the On Exit event to pause? In that case the SWF-behavior is normal behavior: the action occurs only after exiting the slide, so Pause will be on first frame of next slide.
    Why not add a click box, time it for the rest of the slide and it will pause at the last frame. And you talk about a Forward button? Why not use the pausing of that button to pause at the last frame (or almost at the last frame)?

  • Switching Frames (cardsLayout), doing something, waiting for button

    Hi,
    I am switching JFrames in my application and each frame is to call a specific function and then wait for a button click.
    so the code would be:
    function(){
            cardsLayout.show();
            doSomeCalculations();
            waitForButtonClick
            continueWithSomething //depending on which Button was clicked
    }My problem is, how to realize the waitForButtonClick?
    What would you suggest? I have heard about synchronize. Is this the way to go, or is there an easier/better way?
    Besides a while(notClicked) way ;-)
    Thanks!

    pir wrote:
    it is not that I do not want to learn Java. Please understand that Java is not with what I am earning my living, it is a tool for me, to make some task easier, which I would have otherwise have to do step by step by hand. I will never be as good as someone who spends his time with Java every day. I also have only a specific task to perform in a given time, so I need only specific information - which I am definitely willing to learn - and not all there is about Java and Swing.You must understand that at its core, your question is not about anything specific but rather it boils down to: "how to create an event driven program in Swing".
    The only reasonable answer to this is to send you to the Swing tutorials where, if you have the interest, ability, and inclination, you can learn the tools needed to do Swing and event programming. If you choose not to do this, no one in this forum can help you. Period.
    I hope this clarifies the situation enough, to allow someone to have a heart and point me in the right specific direction, even knowing that I might use this knowledge only once.And once again, I recommend that you hit the Sun Swing tutorials and start learning. Accept this and follow this recommendation and you will find success. If not, well,... it's your choice.
    Thank you in advance for any specific help.This is as specific as it's going to get at this stage. Much luck.

  • Text Entry not waiting for entry before continuing

    Captivate 4
    I'm trying to add a TEB where the user will need to enter the correct text before moving to the next slide.  I would like it to continue as soon as they user types the correct entry.  The problem is that the slide doesn't pause to wait for the entry - it continues to the next slide without anything being typed or a click.  ??
    I have the correct text listed in the 'Correct Entries' box and have it set to 'go to next slide' for 'On success'.  Under 'Options', I have it set to 'Validate User Input'.  I do not have any hint or caption buttons, and I am not showing a 'submit' button.
    Can someone tell me how to get it to pause the training to wait for the user to enter the correct text?
    Screen shots below.
    Thanks in advance,
    D

    Hi there
    Indeed there is!
    You enable the Button in the properties. This will place an associated button next to the field.
    What's that you are asking? You don't want a button?
    Well, nobody said you actually have to SEE the button! Just double-click the button and its properties will show. Choose Transparent Button and configure it so it's invisible. Then you configure the other "1" for the Button press!
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Sending an object from client to server always on button press

    What I need is to send an object from client to server but I need to make server wait until another object is sent. What I have is the JFrame where you put the wanted name and surname, then you create a User object with these details and on button press you send this object to the server. I just can't hold the connection because when I send the first object, server doesn't wait for another button click and throws EOFexception. Creating the while loop isn't helpfull as well because it keeps sending the same object again and again. The code is here
    public class ClientFrame extends JFrame {
        private JButton btnSend;
        private JTextField txfName;
        private JTextField txfSurname;
        public ClientFrame() {
            this.setTitle(".. ");
            Container con = this.getContentPane();
            con.setLayout(new BorderLayout());
            txfName = new JTextField("name");
            txfSurname = new JTextField("surname");
            btnSend = new JButton(new AbstractAction() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    SSLSocketFactory f =
                            (SSLSocketFactory) SSLSocketFactory.getDefault();
                    try {
                        SSLSocket c =
                                (SSLSocket) f.createSocket("localhost", 8888);
                        c.startHandshake();
                        OutputStream os = c.getOutputStream();
                        ObjectOutputStream oos = new ObjectOutputStream(os);
                        InputStream is = c.getInputStream();
                        ObjectInputStream ois = new ObjectInputStream(is);
                        boolean done = false;
                        while (!done) {
                            String first = txfName.getText();
                            String last = txfSurname.getText();
                            User u = new User();
                            u.setFirstName(first);
                            u.setLastName(last);
                            oos.reset();
                            oos.writeObject(u);
                            String str = (String) ois.readObject();
                            if (str.equals("rcvdOK")) {
                                System.out.println("received on the server side");
                            } else if (str.equals("ERROR")) {
                                System.out.println("ERROR");
                        //oos.writeObject(confirmString);
                        oos.close();
                        os.close();
                        c.close();
                    } catch (ClassNotFoundException ex) {
                        Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IOException ex) {
                        System.err.println(ex.toString());
            btnSend.setText("send object");
            con.add(btnSend, BorderLayout.PAGE_START);
            con.add(txfName, BorderLayout.CENTER);
            con.add(txfSurname, BorderLayout.PAGE_END);
            this.pack();
            setSize(200, 150);
            setVisible(true);
    public class TestServer {
        public static void main(String[] args) {
            try {
                KeyStore ks = KeyStore.getInstance("JKS");
                ks.load(new FileInputStream(ksName), ksPass);
                KeyManagerFactory kmf =
                        KeyManagerFactory.getInstance("SunX509");
                kmf.init(ks, ctPass);
                SSLContext sc = SSLContext.getInstance("TLS");
                sc.init(kmf.getKeyManagers(), null, null);
                SSLServerSocketFactory ssf = sc.getServerSocketFactory();
                SSLServerSocket s = (SSLServerSocket) ssf.createServerSocket(8888);
                printServerSocketInfo(s);
                SSLSocket c = (SSLSocket) s.accept();
                InputStream is = c.getInputStream();
                ObjectInputStream ois = new ObjectInputStream(is);
                OutputStream os = c.getOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(os);
                boolean done = false;
                User u;
                  while(!done){
                    u = (User) ois.readObject();
                    String confirmString = "rcvdOK";
                    String errorString = "ERROR";
                    if (u != null) {
                        System.out.println(u.getFirstName() + " " + u.getLastName());
                        oos.writeObject(confirmString);
                    } else if (u == null) {
                        oos.writeObject(errorString);
                is.close();
                s.close();
                c.close();
            } catch (Exception e) {
                    System.err.println(e.toString());
    }Thanks for any help, btw this doesnt need to be via ssl, the problem would be the same using only http. Please anyone help me:)
    Edited by: Vencicek on 7.5.2012 2:19
    Edited by: EJP on 7/05/2012 19:53
    Edited by: Vencicek on 7.5.2012 3:36

    Current code fails because it's sending still the same entity again(using while loop)No it's not. You are creating a new User object every time around the loop.
    which makes the system freezeWhich means that you are executing network code in the event thread. Don't do that, use a separate thread. At the moment you're doing all that sending inside the constructor for ClientFrame which is an even worse idea: you can never get out of there to the rest of your client program. This is a program design problem, not a networking problem.
    and doesn't allow me to set new parameters of the new entityI do not understand.
    I need to find a way to keep Server running even when the client doesn't send any data and wait until the client doesnt press the send button again to read a new object.That's exactly what happens. readObject() blocks until data is received.

  • Custom JDialog, waiting for Button Press

    I want to create a custom dialog so i can do the following:
    Color yrColor = MyColorChooser().showDialog();
    I can create the dialog just fine but i cant get it to return a value
    on a button press.
    Here is my code:
    public class MyColorChooser extends JDialog implements ActionListener{
    public MyColorChooser(){
    super(Main.Frame, "Color Chooser", true);
    // Gui Stuff
    public Color showDialog(){
    setVisible(true);
    // ?? how do i have it wait for button press??
    return YourColor;
    public void actionPerformed(ActionEvent e) {
    if( e.getSource() == Button ){
    returnColor()
    public void returnColor(){
    Color YourColor;
    JButton Button = new JButton();
    }Im clueless when it comes to JDialogs.
    I know i am probably approaching this all wrong.
    I need guidance more in the approach rather than the code.
    If anyone has any suggestions id appreciate it.
    Thank you!

    Maybe this simple example can give you some ideas. Note how I make the dialog modal. This will halt the program flow until the dialog is dismissed.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SimpleTextInputDialog extends JDialog implements ActionListener {
        private JTextField  inputField;
        private JButton     okButton;
        private JButton     cancelButton;
        private String      value;
        private SimpleTextInputDialog() {
            setTitle("Enter a value");
            setModal(true);
            inputField = new JTextField(20);
            JPanel textPanel = new JPanel();
            textPanel.add(inputField);
            getContentPane().add(textPanel, BorderLayout.CENTER);
            okButton = new JButton("OK");
            okButton.addActionListener(this);
            cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(this);
            JPanel buttonPanel = new JPanel(
                    new FlowLayout(FlowLayout.CENTER, 10, 10));
            buttonPanel.add(okButton);
            buttonPanel.add(cancelButton);
            getContentPane().add(buttonPanel, BorderLayout.SOUTH);
            pack();
            setLocationRelativeTo(null);
        public void actionPerformed(ActionEvent e) {
            if( e.getSource() == okButton ) {
                value = inputField.getText();
            dispose();
        public static String getValue() {
            SimpleTextInputDialog dlg = new SimpleTextInputDialog();
            dlg.setVisible(true);
            return dlg.value;
        public static void main(String[] args) {
            String value = SimpleTextInputDialog.getValue();
            System.out.println("Entered value: " + value);
    }And as always, you should study the tutorials:
    "How to Make Dialogs":
    http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html

  • Always need Disconnect power, press the power button wait for 10 seconds...

    I bought a HP computer for a couple of years ( Pavilion a6695it  ) It always works well. But in recent days, I can not start up it. I tried pressed power button on the front of the computer, nothing happend. Then I searched in hp site. finnally, I find this article http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00241069&tmp_task=solveCategory&cc=it&dlc=it&lc...
    In english version the article is here: 
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=bph06788&cc=us&destPage=document&lc=en&product=3...
    Power supply light is on or flashes
    Perform the following steps, in order, until power is restored or it is determined that there is a hardware failure:
    CAUTION:This product contains components that are easily damaged by ElectroStatic Discharge (ESD). To reduce the chance of ESD damage, work over a non-carpeted floor, use a static dissipative work surface (like a conductive foam pad), and wear an ESD wrist strap that is connected to a grounded surface, like the metal frame of a PC.
    Disconnect everything from the computer, including the power cord.
    With the power cord disconnected , press the power button on the front of the computer and wait for ten seconds.
    This is work for me. But now, my computer always need this methond that it can be started up.
    Disconnect power -> press the power button and wait for ten seconds -> then the system will  start up
    So my question: where is the problem? Which part is broken and i should replace? Thanks.
    regards,
    Youli
    This question was solved.
    View Solution.

    Hello youlichika,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that you are not able to power on your desktop, and I would be happy to assist you in this endeavor! 
    In following the document for Troubleshooting Power Supply Issues, were you able to follow steps 3-9? If so, what were the results?
    If you have come to the end of the document, and you still have to drain the power from the computer to power it on, you can find a replacement part (5188-2627) through one of the sites available by following this link.
    I hope this helps!
    Best Regards   
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Wait for button press......

    I have a JButton with an action listener. What I want to happen is when
    the button is pressed and goes into the action performed part it should
    wait for the same button to be pressed again before it does anything.
    The problem is once it goes into the action performed part of the action
    listener the button cannot be pressed again until it leaves...
    Any ideas how this could be done?
    Thanks

    public void actionPerformed(ActionEvent e){
       Object o = e.getSource();
       //the button was pressed once
       if (o == button){
          if(  //count the number of times the button was pressed and then divide it by 2
              /*and if the remainder will be one*/){
             //do this;
          else{
             //this is what you do if there is no remainder meaning the number is divisible by 2
    }You should also try using mouse events.
    You can count the mouse clicks with it.
    Hope this helps you.

  • Wait for user to select the OK button

    For my application I cannot use a simple MessagePopup where the user must select the OK button to continue.
    I created a new panel with just a text message and an OK button to act like a MessagePopup.
    When I call InstallPopup and the Panel box pops up I want to wait until the user selects OK before continuing just like the MessagePopup.
    How can I accomplish this?
    Thanks!
    John W.
    Solved!
    Go to Solution.

    You can use GetUserEvent () function. In the scenario you have depicted you must have all controls in the popup panel set as "Normal" and only the OK button set as "Hot" (The default control mode). The callback the must handle the panel can be structured like this:
    int pnl, ctl, handle;
    // some code here
    // Code to handle the popup
    handle = LoadPanel (.....)
    InstallPopup (handle);
    GetUserEvent (1, &pnl, &ctl); // Wait for the user to press OK button
    DiscardPanel (handle);
    // The rest of the code here
    This help topic gives you additional informations on this subject.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Touch Events: How can I check for a button being pressed while another button is being held down?

    Hello,
    I'm trying to check for a button being pressed while another is down through Touch.  In my case, I' m making a game and I need for a button to make the character jump.  However, when I hold down right, I notice that the jump button becomes somewhat unresponsive and I have to press it twice or more to get it to trigger, as opposed to just pressing the jump button by itself with nothing held down which works fine.  I'm testing this on my Motorola Droid 2.
    Here is some of my code that demonstrates text instead of my character moving around:
    package  {
         import flash.events.TouchEvent;
         import flash.ui.Multitouch;
         import flash.ui.MultitouchInputMode;
         public class Document extends MovieClip {
               Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
               private var controls:BottomBar;
               private var debugText:String;
               public function Document() {
                    addIngameGUI();
               private function addIngameGUI(){
                    controls = new BottomBar();
                    controls.y = stage.stageHeight - controls.height;
                    addChild(controls);
                    controls.aBtn.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.bBtn.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.leftArrow.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.rightArrow.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
             private function testBtns(event:TouchEvent){
                   debugText.text = event.target.name;
    What am I doing wrong?  Is there a better approach?
    Thank you in advance.

    Hello,
    I'm trying to check for a button being pressed while another is down through Touch.  In my case, I' m making a game and I need for a button to make the character jump.  However, when I hold down right, I notice that the jump button becomes somewhat unresponsive and I have to press it twice or more to get it to trigger, as opposed to just pressing the jump button by itself with nothing held down which works fine.  I'm testing this on my Motorola Droid 2.
    Here is some of my code that demonstrates text instead of my character moving around:
    package  {
         import flash.events.TouchEvent;
         import flash.ui.Multitouch;
         import flash.ui.MultitouchInputMode;
         public class Document extends MovieClip {
               Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
               private var controls:BottomBar;
               private var debugText:String;
               public function Document() {
                    addIngameGUI();
               private function addIngameGUI(){
                    controls = new BottomBar();
                    controls.y = stage.stageHeight - controls.height;
                    addChild(controls);
                    controls.aBtn.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.bBtn.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.leftArrow.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
                    controls.rightArrow.addEventListener(TouchEvent.TOUCH_BEGIN, testBtns);
             private function testBtns(event:TouchEvent){
                   debugText.text = event.target.name;
    What am I doing wrong?  Is there a better approach?
    Thank you in advance.

Maybe you are looking for

  • Cannot see file and folders copied from other windows 8

    Hi everyone, The problem is the next: I have new PC for that i was asked to setup and install software, i perform on it clean windows 8 install, it have single HDD 1TB that was partitioned by regular windows setup option to system drive C: 100GB and

  • Safari doesnt download video files anymore

    Downloading from "Activity" window doesnt work anymore for me. Before, i would just open Activity window and double-click on file I want to download, but it doesnt work anymore. When i double-click it just open the same video in a new window but no d

  • CS3 Master to CS4 Design upgrade?

    Hi folks, I have a question about upgrading... I've contacted Adobe a couple times regarding the issue, but they've yet to get back to me...... Anyway, I'm currently running the CS3 Master Collection, and due to some poor planning at my school, I'm b

  • How to enter initial balance for material with moving average price

    We have an issue where the customer wants to split one material into three materials. We are thinking of posting goods issue for the original material and post goods receipt for the new three materials. But how to enter the initial balance since thes

  • Newbie Help With File Parser

    I have an assignment that involves using Java to parse the info on one text file and output to another text file with a header row and a data row both of which need to be tab delimited. I'm relatively new to Java and I'm having a hard time even start