How can I get this function to fire off last?

In the following code, there are two buttons on the stage- "button1" and "button2". 
I want to get the buttons to change frames and THEN have the "playerChange" function fire off.
Currently, the "playerChange" function fires first. Moving the function  either renders the code inoperable or
returns error messages.
function buttonChange (e:MouseEvent)
{if    
                (e.target.currentFrame == "frame1" )
         if (e.target==button1) (playerChange)
                 (e.target.gotoAndStop(player.currentFrame + 1)) 
           else{player.gotoAndStop(player.currentFrame)
          if (e.target==button2)  (playerChange) 
                (e.target.gotoAndStop(player.currentFrame + 1))
          else{player2.gotoAndStop(player2.currentFrame)
button1.addEventListener(MouseEvent.CLICK,buttonChange );
button2.addEventListener(MouseEvent.CLICK,buttonChange);
Note:this is an abridged version of the code. The code I'm actually using uses 20 buttons and about 8 conditionals for each button, so e.target is more convenient than writing a command for each button.

A: How can I get this function to fire off last?

the code is very hard to understand
it's badly formatted
{}'s don't match
you aren't calling a playerChange function
this is my guess at something that might work for you
function buttonChange (e:MouseEvent)
          if(e.target.currentFrame == "frame1" )
                    if (e.target == button1)
                              e.target.gotoAndStop(player.currentFrame + 1);
                              playerChange();
                    else
                              player.gotoAndStop(player.currentFrame);
                              if (e.target == button2)
                                        e.target.gotoAndStop(player.currentFrame + 1);
                                        playerChange();
                              else
                                        player2.gotoAndStop(player2.currentFrame)
button1.addEventListener(MouseEvent.CLICK,buttonChange );
button2.addEventListener(MouseEvent.CLICK, buttonChange);

the code is very hard to understand
it's badly formatted
{}'s don't match
you aren't calling a playerChange function
this is my guess at something that might work for you
function buttonChange (e:MouseEvent)
          if(e.target.currentFrame == "frame1" )
                    if (e.target == button1)
                              e.target.gotoAndStop(player.currentFrame + 1);
                              playerChange();
                    else
                              player.gotoAndStop(player.currentFrame);
                              if (e.target == button2)
                                        e.target.gotoAndStop(player.currentFrame + 1);
                                        playerChange();
                              else
                                        player2.gotoAndStop(player2.currentFrame)
button1.addEventListener(MouseEvent.CLICK,buttonChange );
button2.addEventListener(MouseEvent.CLICK, buttonChange);

Similar Messages

  • My 6th gen nano will go to sleep after 1min. if I don't keep touching the sceen or pushing the buttons. How can I get this function to turn off?

    I can't relax and listen to music as my nano will go to sleep after just one minute of not touching it. This is really irritating and needs to get fixed. Can anyone help? I've read the manual and it doesn't say anything about my problem.

    Your nano is pausing playback when the screen goes dark. The reason for this is that it is not detecting your headset. You may be able to hear music, but the headset jack is not inserted enough for the nano to detect that it is there (or something is blocking the connection). Here are your three options:
    Insert the headset jack harder. Most folks find that this solves their problem. If you can see ANY of the silver of the plug when it is inserted, it is NOT fully inserted. You should feel and hear a click" when it is fully inserted.
    Clean out the crud in the headset port. If you have tried #1 and it just won't insert all the way, it is likely that you have crud in your headset jack. Shine a light in there. The entire inside of the jack is white, so if it looks dark down at the bottom, there is probably crud down there. You can try blowing it out or using canned air. Just understand that shoving anything else in there to clean it out will be taking your warranty into your own hands! However, I have cleaned mine out using whatever was handy and small enough to fit in there and so far so good. Your results may vary!
    Take it to the Apple store. If you have really tried with 1 and 2 and it is still happening, then there might just be something up with your headset port or your headset jack. If it is the headset jack, you can look closely at that and be pretty sure if that is the problem. Try another headset to make sure. If you have worked all the way through to this point and it is still happening, it is time to take it to the Apple store.
    i
    PS: For more on this, with pictures, see this post: https://discussions.apple.com/thread/2765444?start=30&tstart=0

  • Today I updated the OX Maverisk. It turns out that the three finger gesture in the finder( go back and forward) is disabled. How can I get this function back? I love it so much!!!

    Today I updated the OX Maverisk. It turns out that the three finger gesture in the finder( go back and forward) is disabled. How can I get this function back? I love it so much!

    Try System Preferences/Trackpad/More Gestures.

  • I have a new ipad air and it has this weird function where i have to double touch everything how can i get this to stop?

    I have a new ipad air and it has this weird function where i have to double touch everything how can i get this to stop?

    Settings > General > Accessibility > VoiceOver:  OFF
    On your way, tap once to select an item, double-tap to activate an item, swipe three fingers to scroll.

  • TS1702 My cars 2 app mate app is not working after upgrading from ipad to ipad 2...... synced.... uninstalled and re installed several times as well as wiped ne ipad out and re did the whole proccess several times. how can I get this app working?

    I have installed the cars 2 app mate on a ipad 2 from an ipad 1 synced with itunes account.. all is working except this app. After many times of un installing and re installing aswell as talking to apple tech suport this app is still not working.... its there it just has no function...... how can i get this installed and working, my grandson is autistic and uses this app many hours a day........ it is important for me to get this up and running again for him.......

    (1) So, I found a youtube video showing how to open up my iMac and replace a Disk drive. I opened it. I removed the disk drive. I opened the metal cover of the lid of the disk drive. It was clean and immaculate; so, it destroyed and debunked the dirty drive theory. But, just to make sure I sucked around the optical sensor with a vacuum and gently brushed it with a Q-tip.
    (2) I then watched a you tube video showing how the drive operated (it was a drive supplied with power outside an iMac with a transparent cover unlike the opaque metal cover that we have on our drives). My scientific curiosity started to wonder if somehow the mechanical part (of the electro-mechanical assembly) was locked or jammed. So, I started messing with the arms with the utmost care after watching the video to see if i could move them manually. Yes on some. The main arm that is linked with the drive motor was immovable. The rest I played with a little bit, took great notice in the start of the video to see how the arms looked before inserting a disk. I then put it all back together.
    It works now. My guess is that taking it out and then placing it back in along with the resetting options that others have done was the trick. I believe it is a possibility that the hard drive became locked mechanically in some strange manner after ejecting a DVD in conjunction with the uploading of the new OS. I believe the actual removal, reinstallation, and resetting of the drive put everything back into sync. My computer sits in a climate controlled dust free environment. I knew for a fact that this hard drive was OKAY.

  • The message function on my Ipad just quit working.  I was using it while in Mexico and it just quit.  I have come home and synced my Ipad with Itunes and function still does not work.  How do I get this function to work again?

    The message function on my Ipad just quit working.  I was using it while in Mexico and it just quit.  I have come home and synced my Ipad with Itunes and function still does not work.  How do I get this function to work again?

    When I use find file http://www.macupdate.com/app/mac/30073/find-file (which does tend to find files that "Finder" can't), it's not coming up with any other itunes library files that have been modified in the past week, which I know it would have been - unfortunately, I don't have a very recent backup of the hard drive.  It would be a few months old so it wouldn't have the complete library on it....any ideas?  I'm wondering if restarting the computer might help but have been afraid to do so in case it would make it harder to recover anything...I was looking at this thread https://discussions.apple.com/thread/4211589?start=0&tstart=0 in the hopes that it might have a helpful suggestion but it's definitely a different scenario.

  • I was advised by Adobe tech on Chat that my Serial Number is for a MAC and I have a PC...but he didn't offer to change my platform...how can I get this done?

    Case Number:0214213994
    I was advised that my serial number for CS6 Master Collection was for MAC...I have a PC.   The agent didn't offer to change platform for me which I was since advised by the college that this is what he should have done.
    How can I get this done as I am rarely able to access the 24 hr chat option.

    Thanks for your help Jeff...actually it turned out that Chrome was the issue and even FIrefox didn't work ....it was slow clunky old IE that eventually got me the chat option and I finally got my issue resolved.....I was getting pretty desperate and am now VERY happy to have my Master Collection back.
    Sorry I don't know enough about plugins to help you there but all other functions that I need to do with Chrome work as a rule so I cannot help as far as Adobe is concerned.  I know that Chrome often has shock wave errors due to incompatibility with the player on my device but otherwise I'm clueless.

  • Adobe CR 6.7 does not install into CS5, how can I get this installed to view CR files?

    Just installed CS5 onto new computer. Adobe bridge and CS5 do not recognize CR format. How can I get this installed. I have tried up dating and downloading the CR6.7 update, but can not get it to install. What do I do?

    Product updates

  • Hello, I want to restore a backup on my Iphone 4S, but in i-tunes it's not vissable. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Hello, I want to restore a backup from this afternoobut in i-tunes it is not visseble. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Follow the steps in this article to restore from iTunes back up:
    http://support.apple.com/kb/HT1766
    Since you say you cant see the back up in iTunes you should be able to see it when following the last step where it says for iTunes 10.7 or earlier. Dont worry as this step also works for iTunes 11.

  • My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    1. Update iTunes to the latest version. Plug in your iPod. If iTunes still can't recognize it, then in iTunes in the top left corner click help> run diagnostics. On the box that comes up, check the last two things. Click next and it should identify your iPod.
    2. Click on your windows start menu. Type in "services". Click on it and when it pops up, on the bottom of it click on "standard". Now Scroll down to find "Apple Mobile Device" Right click it when you see it and click on "Start". When it has started, close iTunes and replug in your iPod and it should show up.
    3. Check the USB cable
    4 Verify that Apple Mobile Device Support is installed
    5. Restart the Apple Mobile Device Service and verify that the Apple Mobile Device USB Driver is installed.
    6. If you just want to add some photos, songs and movies from computer to your devices, you can use an iTunes alternative to do the job
    7. Check for third-party software conflicts.
    <Link Edited By Host>

  • My "Hanging with Friends" app keeps crashing whenever I try to open it. I have deleted and re-downloaded the app, restarted my iPhone, and even restored my iPhone all together, and nothing is working. How can I get this app to work again?

    My "Hanging with Friends" app keeps crashing whenever I try to open it. I have deleted and re-downloaded the app, restarted my iPhone, and even restored my iPhone all together, and nothing is working. How can I get this app to work again?

    Can you start Firefox in [[Safe mode]] ?
    You can also do a clean reinstall and download a fresh Firefox copy from http://www.mozilla.com/firefox/all.html and save the file to the desktop.
    Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
    It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    You can initially skip the step to create a new profile, that may not necessary for this issue.
    See http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • HT4798 i created my apple id account, verified but know i m unable to log on, it says incorrect password, i tried to reset via forgot password option but it does not send reset password page to my e- mail address, how can i get this sorted or delete my pr

    User created apple id account, verified but know she is unable to log on, it says incorrect password, she tried to reset via forgot password option but it does not send reset password page to here e- mail address, how can i get this sorted? or how can i get her whole apple account deleted and created new one using same e - mail address?

    The idea to jumpstart by change was not the smartest one, but gives you an opportunity to use that "temporary" account as permanent. You do not have a choice cause obviously despite you thinking that old account is no more -it does exist on Apple servers. And if you are unwilling to share your [email protected] with friend, just create one extra [email protected] for your friend. One suggestion - do not use gmail.

  • When I am home, calls to my iPhone 5 also go to my other family members' iPhones.  How can I get this to stop happening?

    When I am home, calls to my iPhone 5 also go to my other family members' iPhones.  How  can I get this to stop happening?

    Or better yet, create and use new Apple IDs for others in your household. You could always use different Apple IDs for iCloud services (like iMessage and FaceTime) and iTunes and App Store., but it's even easier to share purchased content now with Family Sharing.

  • I bought 3 iPhone 4s and each should have 5gb of cloud. I want to only use my one iTunes ID. How can I get this storage space increased to the 15 GB?

    I bought 3 iPhone 4s and each should have 5gb of cloud. I want to only use my one iTunes ID. How can I get this storage space increased to the 15 GB?

    iCloud storage is not allocated by device. iCloud storage is allocated to your iCloud AppleID. You get 5GB of iCloud storage.

  • Somehow my iTunes app has been put into the trash.  How can I get this and all of the stuff that was in it back to my Application folder?  I try to drag it out of trash, but it won't work.

    Somehow my iTunes app has been put into the trash.  How can I get this and all of the stuff that was in it back to my Application folder?  I try to drag it out of trash, but it won't work.

    Also, when I do try to drag it out of the Trash to put it back into Applications (on the Finder sidebar), it asks me to authenticate with the administration password.  I enter it, and then a window appears saying that I can't do that because I do not have permission to modify iTunes.  Please help.

Maybe you are looking for

  • Two External Hard Drives and Time Machine

    Hi All Does anyone out there know if it is possible to use Time Machine to backup information from one external hard drive to a second external hard drive? I dont want to store this particular information on my internal hard drive (partly because the

  • How to get audio in imported files?

    I'm trying to import a keynote file from iwork 09 into the ipad version. the presentation has background audio (mp3) and everytime I try to import, the soundtrack is removed by the application. Im using the new Keynote 1.2 for ipad and keynote 5.0.4(

  • E-Mail not send when relevant BP is in more than one partner function

    Dear all, i am facing an big issue. My e-mail action does not work if the bp of the recipient is stored in more than one partner function in this incident. Is this a know bug ? What can i do about that? Best Regards Daniel Edited by: Daniel Titze on

  • Updating indesign Pantone swatch books

    why is it that the pantone book references in design cs4 do not tally up with the pantone books that i have, i am using up to date books with with like for like matches i.e pantone solid uncoated in indesign and in the reference book, yet there is a

  • Reduced Change Pointers?

    Hi, I have to implement reduced change pointers to MATMAS. ie my requirement is that change pointers will write only for some plants specific materils and not for all materials. So i have implement the badi BDCP_BEFORE_WRITE and used the method FILTE