Knowing which button is clicked

i have code that creates button objects ,stores them in array
and adds action listeners as follows.i want to code clickstart such
that i can change the label of the clicked button.
var buttonlist=new Array();
for(var i:int=0;i<10;i++){
mybutton=new Button();
mybutton.x=10;
mybutton.y=10+50*i;
mybutton.width=50;
mybutton.height=50;
mybutton.label="no:"+i;
mybutton.addEventListener(MouseEvent.CLICK,clickStart)
mycanvas.addChild(mybutton);
buttonlist.push(mybutton);
thank you

Try this:
private function clickStart(evt:MouseEvent):void {
evt.currentTarget.label = "some new label";
Vygo

Similar Messages

  • How to identify which button is clicked in an action

    Hi,
    I am just checking whether it is possible to build calculator or not in webdynpro for abap.
    I have some buttons and i have associated same action for all the buttons and in that action i would like to know which button is clicked.
    Please let me know the code for that
    Thanks
    Bala Duvvuri

    Hi Bala,
    Its possible. Just go to the action handler for the button & read the attribute ID of the WDEVENT which is passed by the framework. This id will contain the id of the button which triggered the event. Consider the code fragment below:
    method ONACTIONACTION .
        DATA:  lv_button_name type string.
        lv_button_name = wdevent->get_string( name = 'ID' ).
    endmethod.
    At the end of execution lv_button_name will have the ID of the button which triggered the event.
    Regards,
    Uday

  • Which button is clicked?

    hello,
    I have a an array of buttons, which has 20 buttons.
    How can I know which button is clicked inside actionPerformed method.
    THANKS
    Chamal.

    Search for the Java Tutorial and carefully read the section on event listeners. You can find lots of sample code there.
    Basically, you can branch on action commands (typically the label on the button) or event sources (a reference to the object which fired the event). The second method is preferrable to the first, particularly with regard to internationalized applications.

  • How can I find which button is clicked?

    I have two buttons on my page.Is there any way so that I can find which button is clicked in my JSP page?I do not know javascript I tried to pass a parameter by url rewriting through a Javascript function to another page.
    But it did not work? how can I do this?
    Can I return a parameter from javascript to a JSP page?
    Plz help me
    Thanks in advance
    Amit Varshney

    If you give the submit button a "name" attribute, the name of the button you pushed will come through as a parameter, along with its "value" (the text on the button)
    ie
    // in your jsp page
    <input type='submit' name='button1' value='FromB1'>
    <input type='submit' name='button2' value='FromB2'>
    // in your servlet code...
    boolean b1Pressed = request.getParameter("button1") != null;
    boolean b2Pressed = request.getParameter("button2") != null;

  • How Do I Know Which commandButton was Clicked in the Validation Phase?

    I have three <h:commandButton ... /> components in a single form. In order to implement some validation rules, I need to know which one was clicked. I cannot rely on the configured actionListener methods because they have not yet been invoked in the JSF life-cycle.
    It seems that the components representing each of these buttons get created and their values are all set to null. So that doesn't help.
    I could set a hidden field using a JavaScript onclick event handler, but that seems to be a hack for something that any decent web application framework should be able to handle elegantly.
    Thanks in advance for any help.
    Atif Faridi

    Thanks for the quick reply.
    I considered that, but ruled it out as an option because I was convinced that JSF would offer something better.

  • Determine which button is clicked

    I am creating the download buttons on my page dynamically and I am assigning the name also dynamically attaching the counter with the name. Now On form post, i want to know which button( button at which counter ) was being pressed. Could u help me on this.

    Use request.getParameterNames( ) to get an enumeration of all the names passed by the form. You can then go through the list and determine which button was pressed since the name of that button would be passed along.
    If you are uncomfortable with using the enumeration technique, do a request.getParameter( button_name ) for each button and check whether you get a null value which implies the button wasn't pressed, or the counter value, which implies the button was pressed. If you have a lot of buttons, this results in some redundant code, but if you have only one or three, then this is probably an ok way to do it.

  • How can I know which link was clicked in the link list

    Hi everyone
    I'm using list of links in my page to display list of the files in some directory.
    How can I know which link user was clicked. There are some code:
    <%
    String dir = "..//files//";
    File fin = new File(dir);
    File files[]=fin.listFiles();
    for(int i=0;i<files.length;i++)
    File x = files;
    %>
    <%=x.getName()%><br>
    <%
    %>
    Please help

    You need to pass some data on the querystring to the page you are linking to.
    <a href="Main_Work.jsp?file=<%=x.getName()%>"><%=x.getName()%></a><br>
    This will send a parameter called "file" with the value of the file name that the user clicked.
    Now in Main_Work.jsp you can access this data as follows:
    <%
    String s = request.getParameter("file");
    File f = new File("..//files//"+s);
    %>

  • Servlet: How do I know which button was pushed?

    Hi All,
    I have a web page that has two buttons on it, one to log out and to other to retrieve items (HTML is below). I have a servlet that receives the HTTP Respone/Request and passes the Config and Request to an BasicHandlerManager class that will look to see which button was pushed and then perform an action based on the button that was pushed. Well, in the BasicHandlerManager class I do not know how to determine which button on the web page was pushed. How do I determine that? I've found that they 'if' and 'else if' that contains the "Logout" and "Retrieve" always executes the 'if' statement and never the 'else if'. When I swap the "Logout" and "Retrieve" that are in the 'if' 'else if' statement it will still execute the 'if' and not the 'else if'. So, how do I determine which of the 2 buttons was pushed on the web page?
    Here's my HTML and some code from the BasicHandlerManager.
    Thanks for your help.
    HTML Code:
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="Retrieve" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="Logout" VALUE="Logout">
    BasicHandlerManager Class:
    BasicHandler handler = null;
    if (request != null)
        String strRequestID = request.getParameter("requestID");
            if (strRequestID != null)
                if (strRequestID.equals("LOGIN"))
                    handler = new AccountDelegate(config);
                else if (strRequestID.equals("HOMEPAGE"))
                    if (request.getParameter("Logout").equals("Logout"))
                        handler = new Logout(config);
                    else if (request.getParameter("Retrieve").equals("Retrieve"))
                        handler = new ProductDelegate(config);
                if (handler == null)
                    handler = new DefaultHandler(config);
            } // end if (strRequestID != null)
    } // end if (request != null)
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    First change your buttons so they have the same name
    thus
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="Retrieve" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="Logout" VALUE="Logout">
    becomes
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Logout">
    Now in your servlet you will want something akin to the following.
         public void performTask(
              HttpServletRequest request,
              HttpServletResponse response)
              throws ServletException, IOException {
              String action = request.getParameter("SUBMIT") ;
              if( "Retrieve".equals(action) ){
                   //     Perform whatever operation needs to be done on Retrieve
              else if( "Logout".equals(action) ){
                   //     Perform whatever operation needs to be done on Logout
              else {
                   //     Perform whatever operation needs to be done if all else fails
         }By giving your buttons different names, which seems like a really good idea at the outset, you give them different parameter names in the request which A) takes up more space in the request and B) means you have to check both parameters. These are essentially the same action (Submitting) so you use the Value to retrieve the action indicated by the button.
    Regards,

  • DataTable with commandLinks  - How do I know which one I clicked?

    So, imagine I have a dataTable which returns rows from my database (any SELECT * FROM TABLE) and I want to, for example, delete the one object from row N, how do I know, if I put <h:commandLinks> after each row, which row I clicked?
    It's been really hard to do such a simple thing in JSF for me. Help!

    You'd better use selectBooleanCheckbox to delete the selected row rather than sommandLink. This way you'll be able to select more than one row and to delete all selected rows at the same time.
    Hope this helps!
    Ragards,
    Mariana Getova

  • Trying to get a movie clip to go both up and down depending on which button gets clicked

    hello,
    I have a file with 5 movie clips in it. I have a button that when clicks, plays each one. One of the movie clips needs to move both up and down and I am having a lot of trouble with this.
    stop();
    function showVenue(Event:MouseEvent):void
              mc_speaker.play();
    function showSpeaker(Event:MouseEvent):void
              mc_compliance.play();
    function showCompliance(Event:MouseEvent):void
              mc_strategic.play();
              mc_data.play();
    function showStrategic(Event:MouseEvent):void
              mc_data.gotoAndPlay("down");
    function showData(Event:MouseEvent):void
              mc_data.gotoAndPlay("up");
    btn_viewMore_Venue.addEventListener(MouseEvent.CLICK, showVenue);
    btn_viewMore_Speaker.addEventListener(MouseEvent.CLICK, showSpeaker);
    btn_viewMore_Complinace.addEventListener(MouseEvent.CLICK, showCompliance);
    btn_viewMore_Strategic.addEventListener(MouseEvent.CLICK, showStrategic);
    btn_viewMore_Data.addEventListener(MouseEvent.CLICK, showData);
    Is there anyway to attach my file here for someone to look at???
    thanks!
    babs

    Well, on the mc_data movie clip, I had the animation going up and down with stop actions to stop it. so I put labels on those areas and tried to just control it that way. Seemed simple enough, but not working.
    I really don't know how to control the toggle up and down in AS without using the timeline....just trying to help a friend, and ready to scream..I thought this would be so simple...
    would be easier to explain if I could show you a dummy file...but I still don't see an attach button????

  • How to know which button has been selected on portal screen

    Dear Freinds,
                i an abaper i have one specific doubt regarding icon which has been selected on the portal screen.
    My requirement is we have portal screen on which i have two Buttons(or links) one Self and another for Dependents. i have to write an Bapi or RFC and give it to webdynpro developer.
    i have to write logic in my RFC based on the button selected on the portal screen (self or dependent) .
    in my RFC function module i have used import parameters &  table parameters( return value for the webdynpro to pick up)  . In the table parameters i have given structure z_struc  & the  Z_Struc has basically three fields
    a) self b) depndt c) flag.
    so i have written logic as
                       if v_flag_self = 'A'
                        logic for the self of the employee
                       elseif  v_flag_dep = 'B'.
                        logic for the dependent.
                       endif.
    so any one  could please let me know how i should pass on to the webdynpro
    or to recognize that the value for the Self he has to consider is A
    and dependent button he has to take is B. Because based ont he this flag values
    (A & B) only my logic works.
    how i should pass this values to him .
    Regards
    latha.

    Thanks!
    This wasn't there when I first looked at it, or I was looking at another location of the api, I will make sure to look at this one now :D.
    I basically did Action action = Dialog.show().
    then did if (action.equals(Dialog.Actions.OK))
    //code
    }So it works :).
    I like the custom action too, I'm interested in the example Action response = Dialogs.create()
          .title("You do want dialogs right?")
          .masthead("Just Checkin'")
          .message( "I was a bit worried that you might not want them, so I wanted to double check.")
          .showConfirm();I from the api it says that .create() is static Dialogs Type, so I'm curious how that's used as the Action in this case?
    Thanks again :)

  • How to find out which button is pressed in a form?

    I want to know which button (Insert, Update, Delete) the user has pressed in a form in Portal 9.0.2.3.
    My form is launched so that the ID column is fixed (and hidden). Unfortunately when user presses Insert, the value of the ID is lost. I have tried to work-around this by calling the form again after successful submission. And also I'm trying to improve actions so that the form window is closed if Update or Delete is pressed.
    I have got some solutions from Metalink. My problem is that they not working all the time. E.g. solution below worked this morning, but not anymore (after I have changed the form)! Have I made errors or are solutions shown in Metalink only for Portal v3.xx?
    My code in 'On successful submission of a from..' field:
    DECLARE
    l_action varchar2(20);
    v_id number;
    BEGIN
    -- get the action performed
    l_action := p_session.get_value_as_varchar2(
    p_block_name =&gt; 'DEFAULT',
    p_index =&gt; 1,
    p_attribute_name =&gt; '_STATUS');
    -- If the action is insert then call this form again
    -- If the action is update or delete then close this window
    if (l_action = 'Inserted one record.') then
    v_id := p_session.get_value_as_number(
    p_block_name =&gt; 'DEFAULT',
    p_index =&gt; 1,
    p_attribute_name =&gt; 'A_ID');
    go(PORTAL.wwv_user_utilities.get_url('PROVIDER.LINK_TO_FORM', 'id', v_id));
    else
    go('http://server/closewindow.htm');
    end if;
    END;
    When debugging the code, variable l_action is always null.
    Best regards
    Rainer

    Hi Satish,
    Check this blog -
    /people/alwin.vandeput2/blog/2006/04/13/how-to-search-for-badis-trace-it
    Check Clemens reply in this thread, its great-
    BADI
    <b>Reward Points if this helps,</b>
    Satish

  • To find which user has clicked on which link in capmaign mail

    When a campaign is executed we send a mail to the BPu2019s.now I have couple of link in that mail formu2026.I want to know which person has clicked on a what hyperlinku2026for e.g. I have two link one for sending to yahoo and other for my site addressu2026now i want to know how which person has clicked on which link...
    in the Table CRMD_IM_ML_ITEM field SUM_ACCESS increases by 1 every time a person clicks on the link.....
    is there any table taht i can use to know which kyper link the user has clicked.....
    i read about the adding response id to the mail form.....but don't how or where to use it...
    i need to genrate report later which tells which person has clicked on which link,how many number of time...

    We have a same scenario.could you please tell us the way you resolved it.
    Thanks
    Ramya

  • Making a text field required when a radio button is clicked

    Hello all, I am very new to designing PDF forms, and I want to implement this requirement but have no idea how to go about doing it. I am designing an order form, and in a few different sections of the form are text fields that I want to be required, but only if a certain radio button on the form is clicked. So for example, I have a radio button group on the page consisting of two buttons, and then immediately to the right is a text field. If the user selects button 1, the text field is not required, but if they select button two, the text field is required. How do I implement this? I am using Livecycle ES3. And when I say required, I am referring to the field value/property of "User Entered - Required". Also, I cannot accomplish this by hiding and unhiding the field depending on which button is clicked, as this form will also be printed and filled out by hand, so all fields must be visible at all times. This form does have a submit by e-mail button and that is how it will be used primarily.
    Also, I have searched around the forums a bit, and have tried some Javascript I have found, tying it to a mouseup event on the radio button, for example "getField("Text1").required = (getField("Radio1").value == "Yes");" and "getField("Text1").required = true;" with the names changed for my fields, but no matter what I try it has no effect
    Thanks!

    i hope this helps u.You can always optimize tht code a bit more , it's coded roughly but it works.
    <html>
    <head>
    <script>
    var cursel='r1';
    function radioClick(x)
         if(cursel!=x)
              cursel=x;
         if(cursel=='r2')
              var z=document.getElementById('mydiv');
              mydiv.innerHTML='<input type=text name=ss size=20/>';
              mydiv.style.display='inline';
         else
              var z=document.getElementById('mydiv');
              mydiv.innerHTML='';
              mydiv.style.display='inline';
    </script>
    </head>
    <body>
    <form>
    <input type=radio name=rtt onClick="radioClick('r1');" checked />Radio 1
    <br>
    <input type=radio name=rtt  onClick="radioClick('r2');"/>Radio 2
    <br>
    <div id=mydiv></div>
    </form>
    </body>
    </html>

  • Hi..I m using iphone 5s...i have set password in phone...i came to know that if you click on home button twice rapidly it gets unlock...IOS 8.1...please provide solution on it....

    hi..I m using iphone 5s...i have set password in phone...i came to know that if you click on home button twice rapidly it gets unlock...IOS 8.1...please provide solution on it....

    I suggest that you run software update, after which you should have Safari 6.0.5 - then check Safari - Preferences - Privacy & see that 'Block cookies' is not set to Always.
    Failing that - switch Safari extensions Off via Safari - Preferences - Extensions & test again

Maybe you are looking for

  • Recopilatorio de Queries

    Hola buenas tardes. A modo granito de arena adjunto recopilatorio de queries que pueden serles de ayuda. No adjunto el autor de cada uno porque sería un trabajo minucioso. Si alguno de Ustedes quiere aportar algún otro sería estupendo. Gracias a todo

  • How can I copy my bookmarks without using Firefox Sync?

    I am just not comfortable putting my personal data onto an online server, which is what I'm doing with Firefox Sync. Is there a way to copy my bookmarks onto a flash drive, like we used to be able to do?

  • The mother of all re-boot problems.

    Hi All, I've got that re-boot problem that seems very common but the solutions out there aren't working. Basically the computer will turn on, chime, grey screen comes up, shortly after apple logo, and then the gear starts turning, about 2 minutes lat

  • 10.5 will not boot after install

    I did an upgrade install of 10.5 on my old tower. It said the install was complete and it needed to restart. I restarted and the apple logo screen came up. After several seconds the machine just shut down. Subsequent attempts to boot from this disk c

  • Short Dump issue

    Dear all, hi, i am working on upgrade from 4.6 to ECC6. during unicode this statement is not working in ZReports. IMPORT: it_vbrp          FROM   DATABASE indx(st) ID '1' , It is giving short dump. with message When importing object "IT_VBRP", the st