Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
clipclicmusic

Crop and Drop Shadow

Recommended Posts

Hi Jack

 

The new crop functionality is great. BUT when I have a drop shadow on an object that is a child of the managed item, the crop functionality does not allow for the drop shadow, and cuts it off...

Any way you can have crop account for drop shadows ?

Best

 

Jason

 

PS :

This change you just made :

Crop and allowDelete

Is something I hadn't noticed, but was about to come up against. Thanks !

Link to comment
Share on other sites

Are you saying you want it to crop everything except drop shadows? I'm confused. The crop is basically just a mask, but you want the mask to affect some parts of the masked object but not others? I'm pretty sure that's impossible (well, practically speaking).

Link to comment
Share on other sites

Hi Jack,

 

I could use some help on this as well.

When the crop is applied to a manager. A tween (using tweenmax) I'm using, drop shadow stops working. The layering methods of the transform manager (ie. moveSelectionDepthDown et al) cease to function as well. The cropping works well and as expected. Commenting out the code that adds the crop to the manager restores the layering and the drop shadow tweening.

 

Let me know if I've been clear in my description of the problem and if you think there is a resolution.

 

Best Regards,

 

Rich

Link to comment
Share on other sites

Is there any chance you could post a really simple example FLA that demonstrates the issue(s)? That would be really helpful in identifying and troubleshooting the problem.

Link to comment
Share on other sites

Hi Jack

 

Here you go

 

When the shadow is on the object that is 'managed', all is fine

When the drop shadow is on a child of the managed object, things go awry !

 

Best

 

Jason

Link to comment
Share on other sites

Yep, that is expected behavior. Not a bug at all - masks in Flash always affect the child objects. That's a good thing. It'd be pretty weird if they didn't :)

 

Thanks for whipping together that FLA. It made things super clear.

Link to comment
Share on other sites

Hi Jack,

 

Attached please find a .fla showing the issues I'm having when trying to enable the crop tool.

I've commented out the cropping code to start with so you can see the desired effects.

Please uncomment the cropping portion of the code and recompile to see the effect of adding the crop tool.

 

As Always - Best Regards and Many Thanks,

 

Rich

Link to comment
Share on other sites

It looks like the problem is that you were adding the items to the TransformManager (like manager.addItem(blue_mc)) AND ALSO creating Crop instances for them. Don't addItem() the objects - just create the Crop instances and they'll do the managing for you.

Link to comment
Share on other sites

Hi Jack,

 

Thanks for your quick reply. I've made the changes to the code as per your suggestions.

I'm still not achieving my desired results. It appears I'm targeting the wrong items in the Transform Manager.

I've included the revised .fla in this post. I've added a function that traces what is selected on the stage.

I can see I'm selecting and incorrectly targeting the Crop objects instead of the TransformItem objects.

 

How should I be targeting the items in my layering and tweening functions?

 

Thank you for your kindness and best regards,

 

Rich

Link to comment
Share on other sites

Ah, sorry about that - I completely forgot that in your example, I had added a call to calibrateDepths() on the Crop instance(s) after your depth changes. That was the key (in addition to removing the addItem() calls). However, I just updated the Crop class to add a listener for the TransformManager's DEPTH_CHANGE event so that it takes care of that automatically. It also calls removeItem() on the target from within the constructor just in case you accidentally added the target to the TransformManager previously. So the moral of the story is: download the latest version and you should be good to go :) Sorry about the confusion.

 

Log into your GreenSock account to get it: https://www.greensock.com/account/

Link to comment
Share on other sites

Hi Jack

 

Have sorted all my 'problems'

Thanks for the help

 

Just one thing for anyone lookign for it, something that I got stuck on tonight - dropShadow in the Flash IDE has no alpha... the Tween plugin here has alpha's default set to 0...

I had assumed it would default to 1, so when I did not specify the drop shadow was mysteriously not being applied.

My goof, the docs state that

alpha :Number [0]

 

Best

 

Jason

Link to comment
Share on other sites

Hi Jack,

 

The the new crop tool works great for the layering functions. Thank you very much.

I'm still having trouble trying to target the object Crop.target from the manager.selectedTargetObjects array.

So that I can apply a TweenMax.allTo(??????????, .5, {dropShadowFilter:{color:0x000000, alpha:0.45, blurX:7, blurY:7, distance:7}});

 

Thanks again for all your help.

 

Best Regards,

 

Rich

Link to comment
Share on other sites

Yes, that's because the Crop instance itself is the thing that'd be returned by TransformManager. It's like a proxy of sorts. So all you'd need to do is loop through the selectedTargetObjects array and if you find a Crop instance, replace it with the Crop's target. For example:

 

var targets:Array = manager.selectedTargetObjects;
var i:int = targets.length;
while (--i > -1) {
if (targets[i] is Crop) {
	targets[i] = targets[i].target;
}
}

TweenMax.allTo(targets, .5, {dropShadowFilter:{color:0x000000, alpha:0.45, blurX:7, blurY:7, distance:7}});

Link to comment
Share on other sites

Hi Jack,

 

Thank you for the example. It works perfectly.

I appreciate all of your hard work and talent.

 

Best Regards,

 

Rich

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.
×