Two actions on one button click

Hi All,
I have one button that I want to do two things. When I test
the movie I have to click on the button twice to make both actions
happen. Is my machine on drugs or is there something I'm missing?
Here's the AS I'm using on the button.
on (release) {
gotoandStop(2)
on (release) {
holder_mc.loadMovie("my_movie.swf",1);
Thanks for any help,
Mike

on (release) {
gotoandStop(2)
holder_mc.loadMovie("my_movie.swf",1);
}

Similar Messages

  • Can we perform two actions with one button with two clicks one after other?

    Sir,
    can we perform two actions with one button with two clicks one after other?
    I want that when I click an Add Button first time it add data to the database and when I click again this button it clear the form data to empty fields.
    Regards
    Tanvir

    In code it should be easy.
    The following code adds a button called butman with a text "ADD".
    It then registers a listener that will be called if the button is clicked.
    This listener then calls the runAddData method if you clicked on butman while it contained the "ADD" text and it will call the runClearData method otherwise.
    Therefore it will swap the button's functionality between ADD and CLEAR on every click.
    final Button butman = new Button("ADD");
    butman.setOnAction(new EventHandler<ActionEvent>() {
              @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 this is what you wanted.
    Some extra food for thought.
    You might want to run the ADD and CLEAR methods in their own threads so that it can run in the back ground, without slowing down your user interface.
    I also like to rather reuse one button for multiple functionality in stead of making an application with hundreds of nodes only used rarely with masses of code to show and hide them if needed.

  • Control two functions on one button click

    Hello,
    first off, I am relatively new to actionscript 3.0. I was
    wondering if anyone knows how I can control two events on one (the
    same) button click. On click, the first function must jump the user
    to a particular frame label and at the same time trigger a second
    function which is a movie clip on that particular frame. I must
    note that the event listener is attached to an actual Button and
    not a movie clip.
    Any help would be greatly appreciated.

    Thanks for the quick response. I tried out your solution but
    I get the following error...
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at index_fla::MainTimeline/rev()
    at index_fla::MainTimeline/resources()
    I also tried to create another event listener on Mouse_UP
    ex:
    topNav1_btn.addEventListener(MouseEvent.CLICK, resources);
    topNav1_btn.addEventListener(MouseEvent.MOUSE_UP, rev);
    but I get another strange error...
    ## [Tweener] Error: [object MovieClip] raised an error while
    executing the 'onComplete'handler.
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at MethodInfo-218()
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at caurina.transitions::Tweener$/updateTweenByIndex()
    at caurina.transitions::Tweener$/updateTweens()
    at caurina.transitions::Tweener$/onEnterFrame()
    ## [Tweener] Error: [object MovieClip] raised an error while
    executing the 'onComplete'handler.
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at MethodInfo-241()
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at caurina.transitions::Tweener$/updateTweenByIndex()
    at caurina.transitions::Tweener$/updateTweens()
    at caurina.transitions::Tweener$/onEnterFrame()
    any other thoughts? Thanks in advance.

  • Single form Multiple Actions based on button click

    Hi,
    I have to call two different actions based on button click from single <form > .
    How to achive this?.
    Thank you

    Hi,
    I am using struts <html:form> and my code is as follows
    <script language="javascript">
              function setAction(val){
         if(val==A){
                   window.open(document.forms[0].action="preview.do");
         }else if(val==B){
         document.forms[0].action="create.do";
              document.getElementById('fcreate').submit();
    </script>
    <html:form action="/create.do" >
    <html:text property="name">
    </html:form>
    action is mandatory for <html:form>
    Its not sending the form elements, when I click the preview button.
    Create button works fine. In struts-conig, I have taken same form name for create and preview actions
    Please give me some tips
    Thank you

  • Use two actions in one form

    I want to use two actions in one form in struts,and without using javascript,is it possible?

    I want to use two submit:
    one is for adding message;
    another is for editing message.
    they must be in one form,but i dont know how to use
    two actions in one formHi,
    Hope this helps.
    cheers,
    jeric
    <html>
    <head>
    <title>decision</title>
    </head>
    <body>
    <br><br><br>
    <center><h3><u>Two submits, one form</u></h3></center>
    <%
    String userChoice = request.getParameter("decision");
    if( userChoice != null && userChoice.equals("add") == true)
        // forward to addMessage.jsp, for example, or whatever
    else
    if( userChoice != null && userChoice.equals("edit") == true)
         // forward to EditMessage.jsp, for example, or whatever
    out.println( "<br><center> the value of userChoice after selection is ... " + userChoice + "</center><br>");
    %>
    <center>
    <form method="post" action ="decision.jsp"> <!-- name of this page -->
        <table width = "50%" align="center">
             <tr><td width = "100%"><hr color ="red" ></td></tr>
              <tr><td height = "10"></td></tr>
             <tr><td align = "center">Do you want to <b>add</b> a message or <b>edit</b> a message?</td></tr>
             <tr><td height = "10"></td></tr>
             <tr><td align = "center">
                  <input name = "decision" type = "radio"  value = add checked>?add a message??
                  <input name = "decision" type = "radio" value = edit>?edit a message?
             </td></tr>
        </table>
        <br>
        <input type="submit"  value = " make your selection " >
    </form>
    <hr color ="red" width = "50%">
    </center>
    </body>
    </html>

  • Bluetooth Wireless Mighty Mouse only detect one button click

    I have had my Apple Bluetooth wireless Mighty Mouse for a little over a year and it has just recently began to only detect on button function, and cannot differentiate between left click, right click, or the scroll click.
    It behaves slightly differently under different settings. When I have the scroll click set to do ANYTHING, any click on the mouse will do that respective action. When I have the scroll click turned off, and the left is set to primary and right is secondary, it will do the Primary action. When I have the left set to secondary, and the right set to primary, it will still do the Primary action.
    I have looked all over the internet and have found very little help. The scroll wheel is fine so I don't really want to have to take it apart and glue it back together. Anybody know any tricks? Anything will help! Thanks!

    I found a partial fix over on this thread.
    Basically, the fix is to install the shareware program USB Overdrive and set up the buttons via its control panel. Then uninstall it.
    In my case, USB Overdrive brings my mouse back to normal operation, but when I uninstall it, my mouse goes back to acting like a one-button mouse.
    For now, I'll keep USB Overdrive installed. Maybe I can bill Apple for the $20!

  • Please help : two events on one button

    Hi there
    I set up a simple Flash banner with the following code to click through  to a web page:
    function buttonClickHandler(event:MouseEvent):void {
    navigateToURL(new URLRequest("**URL**"));
    trace("You clicked me.");
    This worked fine, no problems.
    However, I was then asked to include a click counter by using this code:
    btn.buttonMode = true;
    btn.addEventListener(MouseEvent.CLICK, goOut);
    function goOut(e:Event){
    var url:String = root.loaderInfo.parameters.clickTag;
    var request:URLRequest = new URLRequest(**URL**);
    try {
    navigateToURL(request);
    catch (e:Error) {
    I've tried various ways to combine the two events, but it just doesn't  seem to work. I'm only used to one simple action at a time(!) and this  is needed urgently.
    Can anyone please help me resolve this problem? I will keep an eye on  the forum to update with any necessary info asked for.
    Many thanks in advance.

    You can just call two different functions by adding two listeners:
    btn.addEventListener(MouseEvent.CLICK, goOut);
    btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);
    If you want to combine them though, you do have one error - the goOut function needs to accept a MouseEvent, not a regular Event:
    function goOut(e:MouseEvent){
    Also, you shouldn't need the root when grabbing the FlashVar:
    var url:String = loaderInfo.parameters.clickTag;
    You should put a trace in there to make sure it's working as expected.
    And you didn't really say what isn't working. Do you get any errors?

  • Play two MCs with one button

    Hi,
    I'm trying to make the main timeline go to frame 2, and a separate MC go to frame 2 by clicking one button.
    Here's what I'm trying ...
    on (release) {
        _root.gotoAndPlay(2);
        snap1.gotoandplay(2);
    When the button is clicked, the main timeline goes to frame 2, but the MC (instance name) snap1, doesn't play. I'm using AS2.

    actionscript is case-sensitive.  use:
    on (release) {
        _root.gotoAndPlay(2);
        snap1.gotoAndplay(2);

  • Create three textfiles with one button click

    Hello,
    how is it possible to create three textfiles after a button click. I create a textfile with the following code in a page process:
    owa_util.mime_header( 'application/octet', FALSE );
    htp.p('Content-Disposition: attachment; filename="Client_' || to_char(sysdate,'YYYYYMMDD HH24MI') || '.LAS"');
    owa_util.http_header_close;
    htp.prn('test');
    htmldb_application.g_unrecoverable_error := true;
    For the first textfile a savedialog to save the file appears in the browser. But there is no dialog for the second and third file.
    How is it possible to get the savedialog for the second and third file?
    Does anyone can help?
    Best regards,
    Hamburger

    I solved it with javascript:
    window.open("f?p=1:2","_blank");
    window.open("f?p=1:3","_blank");
    window.open("f?p=1:4","_blank");
    and three onload processes on every site!
    Greets

  • 2 functions to one button click

    Hi im creating a banner using the youtube api. What i want is that when you press the button to go to the another video also it apused. Ialready make it work but when i do the same to the other buttons it start creating errors and not working
    function  playRockabillyon(event:MouseEvent)
        gotoAndStop(12);
        videoPlayer.pauseVideo();
    rockabillyon.buttonMode = true;
    rockabillyon.useHandCursor = true;
    rockabillyon.addEventListener(MouseEvent.CLICK, playRockabillyon);

    Hi the problem is that im trying to do a masthead with many youtube players, and when one start and u open another it keep running, so what i want is, that when you press the button to bring you to the other player it stop the video that is runing also. and it works but when im start adding more than one lines inside the playRockabillyon it work sometimes and sometimes no. Right now im changing the way of doing this I thought that is better if all players stop when u go to the frame of an specific player but I have the same problem it works at the beggining with one line but affter adding more it stop working, it only pause the videoPlayer.pauseVideo
    stage.addEventListener(Event.ENTER_FRAME, onFrameEnter);
    function onFrameEnter(e:Event)
        videoPlayer.pauseVideo();
         videoPlayer2.pauseVideo();
        videoPlayer3.pauseVideo();
        videoPlayer4.pauseVideo();
        videoPlayer5.pauseVideo();
        videoPlayer6.pauseVideo();
        videoPlayer7.pauseVideo();
        videoPlayer8.pauseVideo();
        videoPlayer9.pauseVideo();
        videoPlayer10.pauseVideo();

  • One button click call function more than once

    I have a function I call from a button (onClick) which
    inserts a record in mySQL via a PHP page. For some odd reason it
    tends to insert more than 1 record. The extra records tend to be
    duplicates of previous records. I do not know of SPRY is calling
    the function multiple times, if stuff is cached somewhere and it
    calls the cached data and the new data. I perform record INSERTS
    and UPDATES on many web pages via PHP which get called thousands of
    times but only this SPRY application is doing this. Please see my
    code below.
    Spry.Utils.loadURL function: (not that I want to use POST but
    having an issue and so using GET)
    function addcommentget(recordID)
    var newcomment = document.form1.tescomment.value
    Spry.Utils.loadURL("GET","addTEScomment.php?id="+recordID+"&comment="+newcomment,true,Upda teRecordCallback);
    FORM code (where button and textarea are)
    <form action="" method="post" name="form1">
    Add Comment: </br>
    <textarea name="tescomment" cols="40"
    rows="2"></textarea></br>
    <input name="addcomment" type="button" value="Submit
    Comment" onClick="addcomment('{@id}');">
    </form>
    PHP code:
    <?php session_start();
    require_once('Connections/ppg_conn.php');
    $id = $_GET['id'];
    $comment = $_GET['comment'];
    $user = $_SESSION['username'];
    $sql = mysql_query("INSERT INTO
    claimsmanager_tesedits_comments (Ticket_ID, Commenter_email,
    Comment)
    VALUES('$id', '$user', '$comment')
    ") or die (mysql_error());
    ?>
    Is there anything you see that might cause this strange
    behavior?
    Thanks,
    Lee

    Spry.Utils.loadURL() only fires off a single request when you
    call it.
    Aside from the fact that your button calls "addcomment" as
    opposed to the "addcommentget" function you show ;-), I don't see
    any problem. Of course I'm not seeing the big picture, only what
    you post. Do your data sets load URLs that actually perform DB
    updates? Or are they pure DB query URLS?
    I would put a line like this:
    Spry.Debug.trace("AddCommentGet() triggered!");
    in your addcommentget() function and see if you get a single
    trace statement every time you press the button.
    --== Kin ==--

  • Two actions for submit button

    Hi
    I'm new to modifying pdfs so please excuse me.  I have a form with a submit button and the action associated is
    I want to add this script:
    but the form will only do 1 action in the event node.  So how can I make it show the message box and then do the submit? please note that the forum removed the script tags

    Hello,
    You can link your button actionListener to a manageBean method and into this method, call your to ExecuteWithParams binding operation like
    public void actionListener(ActionEvent actionEvent) {
         BindingContext bindingContext = BindingContext.getCurrent();
         BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
         OperationBinding opBinding1 = ((DCBindingContainer)bindings).getOperationBinding("ExecuteWithParams1");
         opBinding1.execute();
         OperationBinding opBinding2 = ((DCBindingContainer)bindings).getOperationBinding("ExecuteWithParams2");
         opBinding2.execute();
    }This also can be included into a valueChangeListener binded to an input component for example
    public void changeListener(ValueChangeEvent valueChangeEvent) {
         BindingContext bindingContext = BindingContext.getCurrent();
         BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
         OperationBinding opBinding1 = ((DCBindingContainer)bindings).getOperationBinding("ExecuteWithParams1");
         opBinding1.execute();
         OperationBinding opBinding2 = ((DCBindingContainer)bindings).getOperationBinding("ExecuteWithParams2");
         opBinding2.execute();
    }Jack

  • Is it possible to combine two functions on one button?

    (i.e. go back one clip + play around playhead)?
    Thanks.

    I don't think so but you could add a shift or option or something to the same button and get a second command

  • Perform multiple actions with one button

    Is it possible to do 2 things when clicking a single button?
    Like this:
    A button adds an item to a collection and after adding the button must be disabled.

    Yes - you can chain multiple commands together with a ;
    In this example, add a button control (Button1) and an Input Text (Text1) control.
    Set the OnClick property for Button1 to:
    Collect(myCollection, {FirstName: Text1!Text}); UpdateContext({ButtonDisabled: false}); UpdateContext({ButtonDisabled: true})
    Set the Disabled property for Button1 to:
    ButtonDisabled
    FYI - The UpdateContext is used twice to change the state of a context variable.
    Let us know if this answers your question -
    Thor

  • Run sequential queries on one button click

    Hello, I hope you can help me.
    I have to export to excel, 20 or so queries.
    What I would like to do is set the date range on a form, and then click Submit.  The submit would perform about 20 queries, one of the other and writing EACH to its own excel file.  Is this possible?
    The queries are exactly the same, except for one WHERE clause.  I can pre-write the queries, all 20 of them, but how I do make them begin after the previous ends?  And what would be the best way to have these write to a file upon completion?
    Thanks guys

    If .csv files are enough for you, then you can construct a variable and use cffile to save it as a .csv file.
    See http://www.cflib.org/udf/CSVFormat for more.
    If you really need .xls file and you don't have CF9, search Internet for "cfx_excel", "cf_excel" or "coldfusion query to excel", or use the Adobe Exchange to search for any excel related stuff for ColdFusion.
    One starting point I found is http://querytoexcel.riaforge.org/ - never tried it. Hope you get lucky.
    -Fernis

Maybe you are looking for

  • Read a file sent as an attachment from CPSC

                       I have a requirement where in CPO has to read a text file sent as an attachment from portal (cisco prime service catalog), Is there a way to query RCdatabase to fetch Document ID and retrive the file and read the file. If this appr

  • Plethora of issues with my NEW computer. Apple won't help

    I bought my brand new Apple MacBook Pro in August of 2011. Paying so much for a product manufactured by such a large and notable company, one would expect to get a piece of machinery that was worth the amount of money that I spent. WRONG. Since I bou

  • Satellite P200-100 is running very slow

    My Vista C: drive is more or less full while my Data E: drive is virtually empty. Could this explain why the laptop is running so slow? Can I move some files from C: to E: and if so will this help or will it cause a problem? Do I need memory expansio

  • Virtual Desktop Apps and Snow Leopard Upgrade

    I'm currently running most recent version of Parallels Desktop and I'm concerned that when I upgrade to Snow Leopard I will lose the use of PD until Parallels' updates their software. Unfortunately, I need to use Windows OS for school! Not much on Pa

  • I have a problem in the email alerts and Twitter and other applications in ios 7

    I have a problem in the email alerts and Twitter and other applications in ios 7 push notifications not working