Jump to content
Search Community

Trouble tweening MC's color with a Drop shadow

Procise test
Moderator Tag

Recommended Posts

Anyone try to tween a movie clips color that has a drop shadow? my shadow seems to change how do I change just the color of the mc without effecting the drop shadow!!!? another head banger.

 

here is the code:

 

img.addEventListener(MouseEvent.MOUSE_OVER, imgOver);

img.addEventListener(MouseEvent.MOUSE_OUT, imgOut);

 

 

 

function imgOver(e:MouseEvent):void{

 

TweenMax.to(e.target, .8, {colorTransform:{tint:0xFF0000, tintAmount:.9}});

 

TweenMax.to(e.target, .8, {glowFilter:{color:0xffffff, tintAmount:1, alpha:1, blurX:30, blurY:30, remove:true}, ease:Back.easeInOut, easeParams:[4]});

 

TweenMax.to(e.target, .8, {dropShadowFilter:{color:0x000000, alpha:1, blurX:20, blurY:20, strength:1, angle:90, distance:1, delay:1}});

//img.addChild(e.target as MovieClip);

 

 

}

function imgOut(e:MouseEvent):void{

 

TweenMax.to(e.target, .5, {colorTransform:{tint:0xA2A4AA}, ease:Back.easeOut});

TweenMax.to(e.target, .5, {dropShadowFilter:{color:0x000000, alpha:0, blurX:0, blurY:0, strength:0, angle:90, distance:1}});

Link to comment
Share on other sites

you need to separate the items that are getting their color changed from those that are getting a dropshadow added.

 

so each item inside of img needs to contain another child element that can have its color changed. when you do this, the value of e.target will become the child of the item that you are mouse_over-ing.

 

*another approach is to set mouseChildren = false to all the parent clips, but the method below involves less code.

 

here is the code:

 


img.addEventListener(MouseEvent.MOUSE_OVER, imgOver);
img.addEventListener(MouseEvent.MOUSE_OUT, imgOut);

function imgOver(e:MouseEvent):void{

TweenMax.to(e.target, .8, {colorTransform:{tint:0xFF0000, tintAmount:.9}});
TweenMax.to(e.target.parent, .8, {dropShadowFilter:{color:0x000000, alpha:1, blurX:20, blurY:20, strength:1, angle:90, distance:1, delay:1}});



}
function imgOut(e:MouseEvent):void{

TweenMax.to(e.target, .5, {colorTransform:{tint:0xA2A4AA}, ease:Back.easeOut});
TweenMax.to(e.target.parent, .5, {dropShadowFilter:{color:0x000000, alpha:0, blurX:0, blurY:0, strength:0, angle:90, distance:1}});

}

see the attached fla to see how it is built

 

note that the "container" clip contains a bunch of mcs which each contain a childImage mc.

Link to comment
Share on other sites

So what about if I wanted to do the same thing but not as a tween but rather the mcs always had a drop shadow an always had there alpha at .05.

 

Would it be...

 

Mc1.Mc2.alpha=.05

 

An then so the alpha won't effect the drop shadow I would do this?

 

Mc1.Mc2.Mc3.dropshadow= (blah blah on iPad don't know code off hand for the dropshadow.) sry

?

 

I'm using cs3

Link to comment
Share on other sites

Mc1.Mc2.alpha=.05

 

An then so the alpha won't effect the drop shadow I would do this?

 

Mc1.Mc2.Mc3.dropshadow= (blah blah on iPad don't know code off hand for the dropshadow.)

 

no.

 

if Mc3 is INSIDE of Mc2 and you apply an alpha of .05 to to Mc2 it will effect Mc2 and all of its children.

 

 

You basically want to do the opposite. Apply the dropshadow to the parent and the alpha to the child.

 

Also, even if you don't want to tween the dropShadow, just use a 0-duration tween with a dropShadowFilter.

 

TweenMax.to(whateverClipYouTarget,0, {dropShadowFilter:{color:0x000000, alpha:1, blurX:20, blurY:20, strength:1, angle:90, distance:1, delay:1}});

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...