Home Contact Sitemap

gb:design

Uh, Blog.

welcome image

rss feed technorati fav

Twitter Updates

    About Arbonne

    Arbonne products are researched in Switzerland, manufactured in the US, botanically based, mineral oil free, vegan certified, and contain no artificial dyes or chemical frangrances. They're an eco-certified company and use organic ingredients when available. All products have a 45-day money back guarantee. Learn more about my Arbonne experience.

    Sign up for Arbonne Specials and Newsletter

    Get monthly updates on the latest products, as well as skincare & healthy living tips.



    * = required field

    powered by MailChimp!

    Hi, I'm Grace! I'm an Interactive Media Designer in beautiful San Diego interested in all things web and healthy living. Welcome.

    ActionScript 3: using hasEventListener

    Published by Grace | Filed under Flash

    I’m currently building out an interactive home page for Aviatech in Flash, and came across an issue when one movie clip controls the opacity of others on its roll over Mouse Event, while these “others” also have Mouse Events. Rolling over the “master” movie clip prevents the “others” from having their Mouse Events assigned, so implementing hasEventListener() has saved my project. Here’s a snippet of how I’ve implemented it:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    public function masterSquareRollOver(e:MouseEvent) {
        var s = e.currentTarget;
        //array of related square movieclips
        var parr = s.arr;
        //loop through array and only highlight if 
        //Mouse Events have already been assigned
        if ( parr.length > 0 ) {
            for ( var p in parr ) {
                var proj = _stage.getChildByName(parr[p].name);
                if (proj.hasEventListener(MouseEvent.ROLL_OVER) ) {
                    TweenLite.to(proj, .25, {alpha: 1});
                } else { 
                	trace(proj.name+": No event listener, ROLL_OVER disabled");
                }
            }
        }
    }

    I also came upon this community site where you can post your code and have others review it, or you can look up methods to see how others are implementing it into their code. Take a look at the query results for hasEventListener(). Happy coding!

    January 25th, 2010

    Leave a Comment