Adding a listener to ALL buttons

I have about 70 buttons on a page - and I want all of them to
get the same eventlistener... can I add it to all of them with one
fell swoop?

Are these Flash Component UI buttons or your own custom
buttons?
With Flash Component UI buttons, this is not a problem. Ex:
function buttons_clicked(evt_obj)
trace ("seventyButtons_clicked()")
trace ("evt_obj.target:" + evt_obj.target._name )
switch(evt_obj.target)
case one_button:
// do something
break;
case two_button:
// do something
break;
case three_button:
// do something
break;
one_button.addEventListener("click", buttons_clicked);
two_button.addEventListener("click", buttons_clicked);
three_button.addEventListener("click", buttons_clicked);
With custom buttons you have a programmers choice on how to
do it. Here is
one basic way
one_btn.onRelease = two_btn.onRelease = three_btn.onRelease =
function()
trace(this)
switch (this)
case _level0.one_btn:
// do something
break;
case _level0.two_btn:
// do something
break;
case _level0.three_btn:
// do something
break;
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"matecito" <[email protected]> wrote in
message
news:e2urkb$p7b$[email protected]..
I have about 70 buttons on a page - and I want all of them to
get the same
eventlistener... can I add it to all of them with one fell
swoop?

Similar Messages

  • Recently can't play music samples on Amazon France and Germany via their usual 'Listen to all' button. Can only play samples individually. Message says roughly RealPlayer not installed on my naigator, but I've changed nothing and have RealPlayer on my PC

    Recently can't play music samples on Amazon France (and Germany, though they've now gone over to Flash, which seems to have fixed it after (re)installing Flash Player) via their usual 'Listen to all' button. Can only play samples individually. Message says roughly RealPlayer not installed on my navigator (see box below), but I've changed nothing and have always had RealPlayer on my PC at least. The 'Aid' page is useless in that it does not provide any links to sites from which one could download whatever it is Amazon Fr thinks one now needs.
    == URL of affected sites ==
    http://www.amazon.fr (e.g. http://www.amazon.fr/Je-Souviens-Tout-Juliette-Greco/dp/B001PU6T04/ref=sr_1_1?ie=UTF8&s=music&qid=1277978559&sr=1-1)

    Hello Neil.
    It has been reported by other uses that RealPlayer is having some compatibility problems with Firefox. I believe this is mostly notorious with RealPlayer Plugin Record Plugin, but it may be the same thing here. Please contact RealPlayer developers for support.

  • Adding a listener to close button on a JFrame

    can I add an action listener to the 'x' button on a JFrame? i want to ask the user if they wish to save when they click the close button on the JFrame...
    thanks.

    Set the default close operation on your frame to do nothing and use a WindowListener, like so:
    import java.awt.event.*;
    import javax.swing.*;
    public class AskBeforeCloseTest extends JFrame {
        public AskBeforeCloseTest() {
            setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
            addWindowListener( new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    int ret = JOptionPane.showOptionDialog(
                            AskBeforeCloseTest.this,
                            "Do you want to quit?",
                            "Quit?",
                            JOptionPane.YES_NO_OPTION,
                            JOptionPane.QUESTION_MESSAGE,
                            null,
                            null,
                            null);
                    if( ret == JOptionPane.YES_OPTION ) {
                        System.exit(0);
            getContentPane().add(new JLabel("Hello"));
            pack();
            setLocationRelativeTo(null);
        public static void main(String[] args) {
            new AskBeforeCloseTest().setVisible(true);
    }

  • Latest update of Firefox is REALLLLLY slow. Is it just all the extra functionality that has been added or is there a button I need to press to make it the same speed as it use to be. Can I downgrade to last version?

    Latest update of Firefox is REALLY slow. Is it just all the extra functionality that has been added or is there a button I need to press to make it the same speed as it use to be? I'll have to start usin safari again as this isn't funny anymore
    Can i retro grade back to the last version?

    uninstalled firefox ....deleted all files still remaining under mozilla firefox directory in program files ... to avoid having to reprogram all my settings, reisntall all addons as well .. I did not remove anything from mozilla firefox that is stored in either appdata or under the windows users directory (if any)
    ... the as suggested reinstalled the latest version of the firefox browser using the link you provided in the email ..; tested and several issues still remain present and unresolved ....
    so please this is urgent or I will have to jump browsers and start using chrome .. because we work 14 hours a day 6 (sometimes 7) days a week, to get ready for the launch of our newest venture and we cannot lose that much days on browser related issues ... so please instead of putting me through week long step process .. of do this .. do that .. can you please actually look into the issue from your end .. I use firefox for so many, many years thta I deserve this kind of support .. thnx Robert

  • Adding a listener to an integer value?

    Hello All
    Is there a way of adding a listener to an integer value that produce an event (run a method with the object) when an integer value is changed? (Through a object.setValue(int) for example)
    Thanks for any help,
    Harold Clements

    Can any of the kilo-posters (that's with two o's) say if it's considered
    bad form to reuse a class that already exists - albeit for a slighty
    different purpose? What I'm thinking is that the SpinnerNumberModel
    is rather close to what's being looked for - the differences being that
    it'll handle any Numbers and has a "next" functionality that we ignore.
    Something like:import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.SpinnerNumberModel;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class NumberEg extends JFrame {
         private SpinnerNumberModel intModel;
         private Random rand = new Random();
         private JLabel aLabel;
         public NumberEg() {
                   // a thing that responds to changes - there could be
                   // many of these
              aLabel = new JLabel("I respond to changes...");
              add(aLabel, BorderLayout.CENTER);
                   // the thing which changes
              intModel = new SpinnerNumberModel(0, null, null, 0);
                   // a change listener which glues the two previous
                   // together - again there could be a number of these
              intModel.addChangeListener(new ChangeListener(){
                   public void stateChanged(ChangeEvent evt) {
                        aLabel.setText(intModel.getValue().toString());
                   // Meanwhile events like button clicks *cause* the
                   // changes
              JButton but = new JButton("Click me!");
              but.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt) {
                        intModel.setValue(rand.nextInt());
              add(but, BorderLayout.NORTH);
              but = new JButton("Reset");
              but.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt) {
                        intModel.setValue(0);
              add(but, BorderLayout.SOUTH);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              pack();
         public static void main(String args[]) {
              NumberEg test = new NumberEg();
              test.setVisible(true);
    }

  • On an iPad with iTunes, do you know if you can edit/delete all your tunes on your device with a "clear all" button rather than having to delete a song one by one like you have to do on an iPhone if not synching via a MacBook/ PC with iTunes account?

      I'm signed up to the Cloud and itunes match - the whole game. But I cam getting annoyed with having to delete songs one by one on my iPhone once dowloaded from the cloud as I only have a 16GB phone....yes I listen to music non-stop!  So, I am thinking about getting an iPAD as I rarely use my MacBook Pro for anything other than surfing and music now...  so the question is:  "On an iPad with iTunes, do you know if you can edit/delete all your tunes on your device with a "clear all" button rather than having to delete a song one by one like you have to do on an iPhone (if not synching via a MacBook/ PC with iTunes account where I know you can clear down and refill with ease)????

    Have you tried
    Settings > General > Usage > Music > Edit > Delete

  • SHOW ALL / HIDE ALL BUTTONS produce error in chm but not in "View Selected Item"

    My SHOW ALL and HIDE ALL buttons work in the View Selected
    Item mode. However, the compiled version generates an error tag:
    Line: 72
    Char: 1
    Error: Object expected
    Code: 0
    URL:
    mk:@MSITSTORE:C\Documents%20and%20Settings\glenn_michaels\RoboHelp%206.0\TCA\!SSL!
    In short, the the compiled chm is located in the SSL. I tried
    adding showhide.js and ehlpDhtm.js to the SSL folder, but that
    didn't make a difference. What is missing? How do I fix this?
    Many thanks in advance...
    glennito

    Mr. Grainge,
    I've tried to follow your instructions to the letter, but I'm
    not having any luck.
    1) I copied the showhide.js to
    a) RoboHelp 6.0 > Project Folder
    b) RoboHelp 6.0 > Project Folder > SSL
    c) RoboHelp 6.0 > Project Folder > SSL >
    MicroSoft_HTML_Help
    2) I pasted btnhideall.gif, btnshowall.gif, printerblue.gif
    into
    a) RoboHelp 6.0 > Project Folder > SSL
    b) they are also listed in RoboHelp 6.0 > Project Folder
    3)The Project Manager > Baggage File originally displayed
    a
    a) Project (Name) folder
    b) ehelp.xml
    c) RoboHHre.Ing
    I opened the Baggage File > Project (Name) folder,
    selected New Baggage File, and added, respectively:
    i. btnhideall.gif
    ii. btnshowall.gif
    iii. ehlpDhtm.js
    iv. printerblue.gif
    v. printerred.gif
    vi. showhide.js
    vii. TCA.fpj
    vii. root.fpj
    4) I also opened rhbag.apj in Notepad. It shows
    a) ehelp.xml and RoboHHRE.Ing accompanied by
    <usercreated>false</usercreated> tags
    b) the remaining baggage files are accomanied by
    <usercreated>true</usercreated> tags
    5) Finally, I used Notepad to display two topic files in
    which the error message identified a Line: XX. In one case the line
    # is 42, in another, 19. In both cases, when I counted lines,
    starting with <body>, I ended up on:
    onClick="JavaScript:hideEm()"
    However, I am none the wiser for my effort and don't know
    what (5) might be telling me.
    6) The only thing I can think of is that the compiled chm
    file is two levels away from the Project Name directory that holds
    all the files. The files live in Robohelp 6.0 > Project Name
    while the compiled help is found in Robohelp 6.0 > Project Name
    > SSL! > MicroSoft_HTML_Help > Project Name.chm.
    Should I be adjusting the Relative Path within the topics?
    Many thanks for your attention and assistance.
    glenn

  • DVD "Play All" Button Only Works for Two Clips

    I have Castle Season 1 on my computer and thought it would be nice to create a DVD of all of them.  I have a "Play All" button and an "Episodes" Button.  Both seem to be registered as a button (Havn't linked the "Episodes" button yet)... I'm hoping to get the "Play All" button to do just that, play all of the episodes in a row, and to do that I have them linked by end action in a row with the last one going to the 'Last Menu'.  It works for the first two episodes and then when I click the next chapter button (In the built in DVD 'emulator') after the second episode it goes back to the menu.  To see if there was a difference in settings I switch between the first and second episodes to detect any setting changes, and there were none (Except the end action was set to different episodes).  I am at a loss on what is wrong.
    If screenshots or settings need to be posted just let me know, and I would be happy to post them.
    Thanks Ahead
    Windows 7 Home Premium 64 Bit
    Adobe Master Suite CS5
    AMD Phenom II B45 (Unlocked Athlon II x3 445)-Not the best CPU, but i'm on a tight budget
    4GB G. Skill 1600 DDR3 RAM
    GTX 460 OC'd
    60GB SSD Boot Drive
    1TB HDD (1x250GB, 1x750GB)

    Glad that Playlist worked for you.
    1.) The buttons don't animate when selected.  On a DVD player, there would be no way to tell the difference on what I had selected, is there any way to remedy that?
    In the Menu Editing Panel>Properties>Motion area, you can check Animate Buttons. This will show the Thumbnails as animations.
    For telling the user which Button has been navigated to, one uses Sub-picture Highlights, which are only 2-bit color. Are you using a Library Menu? If so, which one? If it's a Library Menu, the Buttons should have the Sub-picture Highlights Layer in each Buttons Layer Set. If you created the Menu from scratch, did you add a Sub-picture Highlight?
    2.) I want to add a video clip that will blend into the main menu, how would I go about doing that?
    I do this often. First, I will go into Photoshop, and make a Flattened copy of my Menu, with the Sub-picture Highlight that the user will see (see above), visible. This will then be used in PrPro, as a Freeze Frame. In PrPro, I create the Video file that I want, and at the end, just add that Flattened PSD "Freeze Frame" from the actual Menu. This next part takes just a touch of math, but hang in there with me. We want a seamless transition from that Video to the Menu, so will use a Cross-Dissolve Transition between the Video on the Timeline and the Freeze Frame. We need to set the Duration of that Freeze Frame to just slightly longer than one-half of the Duration of that Cross-Dissolve. All we want is for the full Freeze Frame to be on-screen for a couple of Frames, as the Buttons will be dissolving in, and we do not want the user to begin pressing them yet, as they are NOT real Buttons, but just a graphic of the Buttons. I leave ~ 3 Frames, past the Transition. Remember, when you create that Freeze Frame in Photoshop, you want to make sure that the default Button's Sub-picture Highlight is exactly as the user will see it, when the real Menu comes up.
    Export this Video (w/ that Freeze Frame at the end) from PrPro, as say a DV-AVI, and Import it into En as a Timeline. Set that Timeline to First Play, and its End Action to go to your real Menu.
    3.) My C:// Drive is very small (60GB) as its just a boot drive SSD.
         -3a.) Can I delete the cache without harming my saved encore file? (I only have 1GB left, and my system keeps acting up because of it)
         -3b.) Is there a way to set the media cache to a different drive (I have three, and since using After Effects/Encore/Premiere the free space is shrinking at an alarming rate )?
    This is a bit tricky. Do you ONLY have the one physical SSD? If so, you will seriously want to look into adding more. You can clear the Media Cache files (do not Delete the folders though), however, En will recreate them, when you begin working on the Project. HDD's are cheap, and for Video editing and authoring HDD real estate is very important. If you have more than the one SSD drive, please give us the full details of your HDD's, and how you are using them.
    Good luck, and hope that this helps,
    Hunt

  • Buy All Button Missing from My Wishlist - Answer as to WHY!

    Okay everyone that has been frustrated....or rather HALF of everyone, I finally got an answer from Apple (after being on hold on/off for just under an hour), as to WHY the Buy All button feature was removed from the My Wishlist when wanting to purchase ALL of your items in one purchase, as opposed to each item being purchased and charged separately to your payment account (i.e. debit/credit card, or checking/savings account).
    The reason WHY is because the other half of everyone was frustrated that they were accidentally clicking on the "Buy All" button when it was in iTunes, and buying all of their Wishlist items when they in reality wanted to just buy a select few (be it one or many...but NOT all).  So after listening to the complaints of the userbase and apparently my definition of half is in reality the majority, Apple removed the Buy All button.
    So there you have it!  I feel a sense of relief knowing why and the explanation of it.  Now being a computer programmer myself, I'm sure there is some way Apple can design it so that it would prevent the user from accidentally buying all by providing another prompt or perhaps a checkbox option in some "Settings" environment where the user can toggle on/off this feature.  Any those are my thoughts and that should be the "feedback" to Apple.  Not just to put it back but put it back in this way so the entire user base can be satisified.
    Thoughts?
    P.S. - Apple assured me that if I were to buy the items separately (assuming done within the timeframe, my guess of a few minutes, assuming you don't have a million WishList items) that they still will show up on my credit card as one charge.  I beg to differ and told them that I still got separate charges.
    Hope that my reseach helps alleviate everyone's concerns.

    Dear All,
    Seems to me a total 'own goal'.  I, like many, haven't the time to sit there and purchase each song individually and then there are all the other valid comments about fraudulent alerts etc.
    Dear Apple.  Kindly see sense and revert your systems.  If that's deemed to be too negative, why not develop a best of both worlds solution.  Provide a tick box against each entry in the wish list, with an option to multi populate/toggle.  The purchaser than has the flexibility to buy individually, as a whole or pick and choose. Coding for this is not difficult.  I am amazed that this universally used option (see all email platforms), was not adopted at concept let alone at the time of the rather ill thought out solution of taking down the 'buy all' option.
    As it stands at the moment, you have lost my business.  I can't believe that this decision hasn't affected your sales revenue.  I maybe 1 small voice, but look at the amount of negative commentary going on about this issue.  Please listen to your customer base.
    While you are at it....  Can you reinstate the listen to all option through iTunes store, again I haven't the time to fiddle around looking for the best recording among the many.  This includes wish list as it helps me to make my final decision whether to buy.

  • My iPHONE added a  1 to all existing messages. So none my contacts are linked in my messages or in recent contacts??

    My iPHONE added a  1 to all existing messages. So none my contacts are linked in my messages or in recent contacts??

    If you are a Verizon user, try this:
    Open the phone and dial *228. This is a Verizon over-the-air programming number.
    When the system answer press 1 for "Program or activate your phone"
    Wait for the call to disconnect. You should get a prompt stating "Settings updated."
    Double tap the Home button to bring up the recently used apps list at the bottom.  Locate the Phone, Message, and Contacts apps, swiping if necessary, and press and hold until they jiggle then press the red minus sign to stop them.
    Wait a 3-5 minutes.
    Open the Message App to see if they're fixed.

  • PLAY ALL button

    I have a DVD SP4 project of about 3. Gb in total and the client needs a 'PLAY ALL' button. The video has 8 existing chapters and adding a play all has been impossible to date. I can't replicate the track as it's too large for the disc. Any ideas?

    Use stories or a script
    If there is 8 chapters, use markers 1,2,3,4,5,6,7,8 for the Play All Story. Some discussions with variations on the theme below which will give you the details you need.
    http://discussions.apple.com/thread.jspa?messageID=7006436&#7006436
    http://discussions.apple.com/thread.jspa?messageID=4548144&
    http://discussions.apple.com/thread.jspa?messageID=6998637&#6998637

  • HT1368 wish list had a buy all button.

    In older versions of ITunes , there was a buy all button in wish list. In ITunes 11 , I don't see a buy all button in wish list. Am I not seeing it , or is there a setting I need to change. I have US version. Any help is appreciated. Thanks

    It appears to have been removed in the current version of iTunes, other people have made the same comment. You can try leaving feedback for Apple and maybe it'll be added back in a future update : http://www.apple.com/feedback/itunesapp.html

  • Adding Standalone listener Oracle RAC

    Dear Experts
    We have oracle RAC setup on in our organization, now we also need to do streaming between our RAC server and another oracle server for public reports. We installed another network interface card on of our Oracle RAC server and connect it directly to other server but we are not able to add listener for that interfaces. I did manually entered listener configuration in "listener.ora" and added it also in CRS using "srvctl add listener". Srvctl start listener properly but when i check the status of listener using "lsnrctl status <listener_name> than it shows that listener do not support any services.
    Your help will really be appreciate.

    Dear P
    Thanks for prompt reply. My listener for RAC is working fine, but standalone listener for one node on specific interface is not working. However i have added the listener using "srvctl add listener" command and it also start successfully but it does not support any service. See below the output of lsnrctl status.
    [oracle@mangla ~]$ lsnrctl status listener_mangla_priv2
    LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 08-OCT-2010 13:01:35
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mangla-priv2)(PORT=1522)))
    STATUS of the LISTENER
    Alias listener_mangla_priv2
    Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
    Start Date 08-OCT-2010 12:35:54
    Uptime 0 days 0 hr. 25 min. 41 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/app/oracle/product/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/mangla/listener_mangla_priv2/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.1)(PORT=1522)))
    The listener supports no services
    The command completed successfully
    [oracle@mangla ~]$ lsnrctl status listener_mangla
    LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 08-OCT-2010 13:03:07
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mangla-vip)(PORT=1521)(IP=FIRST)))
    STATUS of the LISTENER
    Alias LISTENER_MANGLA
    Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
    Start Date 08-OCT-2010 08:14:41
    Uptime 0 days 4 hr. 48 min. 26 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/app/oracle/product/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/mangla/listener_mangla/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.0.11)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.0.211)(PORT=1521)))
    Services Summary...
    Service "SYS$STRMADMIN.STREAMS_CAPTURE_CB_Q.PCBA" has 1 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Service "SYS$STRMADMIN.STREAMS_CAPTURE_GLB_Q.PCBA" has 1 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Service "SYS$STRMADMIN.STREAMS_CAPTURE_Q.PCBA" has 1 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Service "pcba" has 2 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Instance "pcba2", status READY, has 2 handler(s) for this service...
    Service "pcbaXDB" has 2 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Instance "pcba2", status READY, has 1 handler(s) for this service...
    Service "pcba_XPT" has 2 instance(s).
    Instance "pcba1", status READY, has 1 handler(s) for this service...
    Instance "pcba2", status READY, has 2 handler(s) for this service...
    The command completed successfully
    [oracle@mangla ~]$ crs_stat -t
    Name Type Target State Host
    ora....LA.lsnr application ONLINE ONLINE mangla
    ora.mangla.gsd application    ONLINE    ONLINE    mangla
    ora....v2.lsnr application    ONLINE    ONLINE    mangla
    ora.mangla.ons application ONLINE ONLINE mangla
    ora.mangla.vip application ONLINE ONLINE mangla
    ora.pcba.db application ONLINE ONLINE mangla
    ora....a1.inst application ONLINE ONLINE tarbela
    ora....a2.inst application ONLINE ONLINE mangla
    ora....LA.lsnr application ONLINE ONLINE tarbela
    ora....ela.gsd application ONLINE ONLINE tarbela
    ora....ela.ons application ONLINE ONLINE tarbela
    ora....ela.vip application ONLINE ONLINE tarbela

  • Event and obj type in one eventlistener function for all buttons

    Hi i have something like this
    button1.addEventListener(MouseEvent.ROLL_OVER, manageMouseOver, false, 0, true);
    button1.addEventListener(MouseEvent.ROLL_OUT, manageMouseOut, false, 0, true);
    function manageMouseOver(event:MouseEvent):void{
      TweenLite.to(button1, 1, {x:100, rotationX:360, ease:Back.easeOut});
    function manageMouseOut(event:MouseEvent):void{
      TweenLite.to(button1, 1, {x:14, rotationX:-360, ease:Back.easeOut});
    and i would like to get one sentence for all button. I would like to create reference obj to use that function for all of my 7 buttons.
    button1.addEventListener(MouseEvent.ROLL_OVER, manageMouseOver(button1), false, 0, true);
    button1.addEventListener(MouseEvent.ROLL_OUT, manageMouseOut(button1), false, 0, true);
    function manageMouseOver(event:MouseEvent, obj:Object):void{
      TweenLite.to(obj, 1, {x:100, rotationX:360, ease:Back.easeOut});
    function manageMouseOut(event:MouseEvent, obj:Object):void{
      TweenLite.to(obj, 1, {x:14, rotationX:-360, ease:Back.easeOut});
    but this is not working. I know that is wrong but what i should do to do this right?

    in the listener function, use the event's currentTarget property to determine which object dispatched the event.

  • One RollOver function for all buttons?

    Is there a way to streamline AS3 code so that all buttons are controlled by one rollover function? The code below isn't working for me.
    function rollOverbtn(e:MouseEvent):void{
    e.target.gotoAndStop(2);
    trace("button HIT");
    function rollOffbtn(e:MouseEvent):void{
    e.target.gotoAndStop(1);
    btn1.addEventListener(MouseEvent.MOUSE_OVER, rollOverbtn);
    btn1.addEventListener(MouseEvent.MOUSE_OVER, rollOffbtn);
    The trace works which shows me that the function IS properly firing, but the rollOver effect is not hitting. I'm sure I'm doing this wrong as I am brand spaking new to AS3.

    You're welcome.  When you use MOUSE_etc events, and "target", the target can end up being a child within the object that has the event listener assigned.  currentTarget always points to the object with the listener assigned to it.

Maybe you are looking for