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.

Similar Messages

  • Control two functions using a button

    Hi,
    is it possible to control two functions like clearing voltage graph and current graph, by just clicking one button on the front panel?
    how can this be done?

    Put the code for both functions inside the same case of a case structure.

  • 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);
    }

  • 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();

  • 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

  • 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.

  • Multiple functions in one button

    Good evening,
    Is it possible to run multiple functions with one button?
    For example: With a button to open and close an object?
    Thanks 

    Hi Rinku,
    This is an example for you:
    A Piano Key Control in C#
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Two functions on one submit button??

    Is it possible to have a button perform 2 functions?
    I would like to have one single button that when clicked will submit the form as pdf to an email address and also print the form to the default printer.
    I have been able to have the button working for email OR print but not for the two.
    When I add the JS code to the submit button to print the form the code is ignored.
    The email dialog box shows and I can then send the email but the pdf is not printed.
    Any help is appreciated,
    FayeC

    use this in a button click event.<br />//capture present XML in a variable<br />var printXML = xfa.data.saveXML();<br />//do the following if you want to print part of the XML<br />var startAt = printXML.indexOf("<SendXML");<br />var endAt = printXML.indexOf("</SendXML");<br />printXML = ""+printXML.substring(startAt, endAt+11)<br />//11 is length of the XML tag may have to adjust this based on<br />//end results.<br /><br />var subj = "email with XML and PDF";<br />//following composes email with PDF attachment<br />event.target.submitForm({cURL:"mailto:[email protected]?&body=following is the final XML<BR>"+printXML+"<BR>&subject="+subj,cSubmitAs:"PDF",cCharset:"utf-8"});<br /><br />Good Luck,<br />Sekahr

  • 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?

  • Can I control two Macs with one keyboard & mouse simultaneously?

    I'm presently the operator and head audio tech for a major Off-Broadway show. I'm running the show on Ableton Live 6 through a Mac Mini, using a MOTU 828mkIII as the Firewire audio interface to the console. "Show control" is basically straight music playback, plus arming and disarming loops, triggering sound FX cues, and stopping and starting playback. The show has been exceedingly stable, no real reason to worry - but the fact that I don't have a redundant backup system concerns me. Theoretically, I can use our Denon CD players to run the show off of discs I've burned, but it's only viable for me because I know the show; a sub running the show would be up the creek - and if we hit a snag and run out of loops, forget it. Furthermore, those of you who've worked with Live know that in a performance based/show control situation, you can remain in an audio loop indefinitely, without any worry of a CD running out of prerecorded loops. (This is a specific reason why we're using Ableton for this show - the music can keep "vamping" until automation and rigging give me the clear to proceed.)
    Considering that I'll be taking some time off this summer, I don't want this to be a concern for my sub(s), so I've charged myself with the task of building a redundant backup. Problem is, I'm not sure how to do it.
    What I've been looking at is a dual Ableton Live/Mac Mini/Firewire interface system. Basically, to duplicate what's running the show presently, and have it running in tandem while the main playback system goes to the house - but for both to be controlled by only one mouse, keyboard and screen, so there's no delay in the event of a crash. If one fails, I send the audio from the backup into the theatre. There would be no disruption of playback, except for the operator`s response time in switching to the backup`s audio output.
    Software like Synergy and Teleport let me share a single keyboard, mouse, and screen over two or more computers - +but only control one computer at a time+. And I've looked for KVM switches and USB "splitters" but they also seem to be toggle devices between one or another computer - which leads me to think I may have to network the two...
    Any ideas are appreciated, even the obvious ones, as I may have overlooked some or assumed some to be out of the question.
    That`s basically it - *simultaneous realtime* control of two computers from one keyboard and mouse. Both Minis performing the same task at the same time.
    Is there software/hardware that can do it, or can I network the backup as a "slave" that mimics the master?
    Thanks.

    Perhaps you could setup a parallel processing network:
    http://daugerresearch.com/pooch/
    The website was last updated 5 days ago according to Google. Hopefully their server will be back up soon. I noticed it wasn't connecting when I tried.

  • 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);

  • Are these a lot of functions for one button?

    i'm something of a novice, just wondering if someone could
    tell me if this looks like a lot to have on each of my seperate
    menu buttons (i realise it may not mean much without knowing how
    big the loadMovies are etc, but just in terms of the number of
    seperate actions/functions per button)
    each buttons has (similar):
    digitalBtn.onRelease = function() {
    setTimeout(backgroundDigital,1500);
    setProperty("blockout_mc", _visible, "0");
    my_ssp.loadAlbum("digitalplanet");
    loadMovie("logos/dp_logo.gif", logoHolder_mc);
    function backgroundDigital() {
    loadMovie("backgrounds/bg_digital.swf", bgHolder);
    many thanks,
    Ray

    Thanks Shane.
    that's actually what i'm doing (for the first time) - didn't
    mean to say that each action is specifically sitting on the button.
    what i'm asking though is if having several different
    functions/actions being called by each of my buttons is a problem -
    each buttons loads 2 movie clips, changes the property of another
    movie clip, and has the setTimeout function, and tells a component
    to load something as well.
    so each of my menu buttons is calling 5 different
    actions/functions - just wondered if that is a lot or if it matters
    at all how many different actions are assigned to one button.
    cheers
    Ponch

  • 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

  • Execute two functions from one Save button

    Hi,
    I am using JDeveloper 10.1.3.0.4 and JHeadstart 10.1.3.0.91.
    Can anybody help me for the following:
    In one editable jspx page I have a save button.
    I want to do the following:
    If I click the Save button, it will save the record and also it will call another stored procedure. I know how to call a stored procedure by clicking a button. But I want to do it from a save button after saving.
    I want my save button will do two things - 1) save the record, 2) call the stored procedure.
    I would appreciate if anybody could help me.
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    It would have been nice if JSF framework would have allowed us to chain the actionListner or specify multiple actionListner, but as of now, that not possible.
    Another option would be to bind the save button to call an AM method.
    By default the save button's ActionListener is bound to the Commit operation.
    - You can create a custom method in your AMImpl.java say void myMethod()
    Which basically first does a commit and then make a pl/sql call.
    - Expose it to the clients via Edit Application module dialog box.
    - Add a method bindings in your PageDef pointing to this.
    - Set the actionListener of you button pointing to this new method binding.
    it will be something like '#{bindings.myMethod.execute}'
    regards - rutwik

Maybe you are looking for

  • Ipad and Phone support

    does Ipad going to support calls and work as cellular phone in the near future?

  • X-Fi sound channel failure.

    X-Fi sound channel failure. I am currently using an X-Fi XtremeMusic PCI card on a 5. speaker system. Sound is not correctly generating on the all speaker channels. When I first started having this issue, the front right channel stopped generating so

  • Color Picker Stops Working in DW CS6

    Every so often, when I use the color picker from within Dreamweaver CS6 to select a color from an image or background, etc., then try to change that color (slightly change the brightness up or down using the system color sliders), it will act as if i

  • Cannot logon via VPN connection using an ICS server

    At home I have a small network set up, using a central PC A on which Internet Connection Sharing (ICS) is enabled (IP address 192.168.0.1 is allocated to this PC). PC B, having VPN client V4.0.x loaded, is connected to PC A. ICS dynamically attribute

  • ICloud iWork File Previews not Showing?

    I create an iwork document on my lion mac, upload it to the cloud, and it either has a pages, keynote, numbers icon instead of a preview of the document. When I save the document, 'I select the option of showing preview in ducument'. If I open the do