Skip navigation
Currently Being Moderated

Tween the icon you are over to its normal state

Mar 20, 2012 1:47 PM

I have this snippet of code I've been running successfuly on my image buttons grouped into one MC.

It applies changes to the buttons I am not rolling over, i.e. if I were to roll over a button the rest of the buttons in the group would dim and blur and etc, but not the button I am over.

All worked fine until I decided to group buttons one more time.

With my limited knowledge of AS3 I was able to put all the actions to the buttons except into making the button I am over to stay the way it is.

In my understanding the problem is in the line:

 

//  target = tween the icon you are over to its normal state

  TweenMax.to(e.target, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});

}

 

particularly in properly specifiying e.target

I tried a few variations but nothing seemed to work.

 

What would be a proper code to go two levels deep into an MC?

 

Below is my full code:

 

IMGS_COLLAGE.buttonMode=true;

IMGS_COLLAGE.useHandCursor = true;

IMGS_COLLAGE.imgORIGINAL_collage.addEventListener(MouseEvent.MOUSE_OVE R, navOver);

IMGS_COLLAGE.imgORIGINAL_collage.addEventListener(MouseEvent.MOUSE_OUT , navOut);

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// //

 

function navOver(e:MouseEvent):void

{

          //loop through all icons

          for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

                    {

                    //tween out all icons

                    TweenMax.to(IMGS_COLLAGE.imgORIGINAL_collage[i], .2, {alpha:.85, blurFilter:{blurX:11, blurY:11}, colorMatrixFilter:{colorize:0x000000, amount:0.25, brightness:0.65, saturation:0.7}, ease:Sine.easeOut});

                    }

                    //                                target = tween the icon you are over to its normal state

                    TweenMax.to(e.target, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});

}

 

 

 

 

function navOut(e:MouseEvent):void

{

          for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

                    {

                    //tween out all icons to a normal state

                    TweenMax.to(IMGS_COLLAGE.imgORIGINAL_collage[i], .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});

                    }

}

 
Replies
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 20, 2012 1:59 PM   in reply to nikolaig

    you must have listeners on each icon or use a hittestobject when a parent listener function executes.

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 21, 2012 7:56 AM   in reply to nikolaig

    what are the objects you want to tween?

     

    currently, in your code you're tweening objects in IMGS_COLLAGE.imgORIGINAL_collage which is a variable of unknown (to me) type and contents.

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 21, 2012 8:25 AM   in reply to nikolaig

    if those mc's are the objects you want to blur in and out, use:

     

     

     

    function navOver(e:MouseEvent):void

    {

              //loop through all icons

              for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

                        {

                      if(IMGS_COLLAGE.imgORIGINAL_collage[i].hitTestPoint(mouseX,mouseY)){

       TweenMax.to(IMGS_COLLAGE.imgORIGINAL_collage[i], .2, {alpha:.1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});

    } else {

                        TweenMax.to(IMGS_COLLAGE.imgORIGINAL_collage[i], .2, {alpha:.85, blurFilter:{blurX:11, blurY:11}, colorMatrixFilter:{colorize:0x000000, amount:0.25, brightness:0.65, saturation:0.7}, ease:Sine.easeOut});

    }

                        }

                    

     

    }

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 21, 2012 9:04 AM   in reply to nikolaig

    you're welcome.

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 21, 2012 9:44 AM   in reply to kglad

    what class type is IMGS_COLLAGE.imgORIGINAL_collage?

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 21, 2012 10:50 AM   in reply to kglad

    then use:

     

     

     

    function navOver(e:MouseEvent):void

    {

    var mc:MovieClip = MovieClip(e.currentTarget);

              //loop through all icons

              for (var i:int=0;i<mc.numChildren;i++)

                        {

     

     

                      if(mc.getChildAt(i).hitTestPoint(mouseX,mouseY)){

       TweenMax.to(mc.getChildAt(i), .2, {alpha:.1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});

    } else {

                        TweenMax.to(mc.getChildAt(i), .2, {alpha:.85, blurFilter:{blurX:11, blurY:11}, colorMatrixFilter:{colorize:0x000000, amount:0.25, brightness:0.65, saturation:0.7}, ease:Sine.easeOut});

    }

                        }

                    

     

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points