This post is a continuation of iteration 2. From the end user point of view Slide effects presented here are almost identical to these from previous post. The only difference is that target components shadow or other filter drawn beside components bounds (0,0 to width, height rectangle) are not cropped during slide animation.
A number of changes was required to implement this functionality:
Determining components visible bounds
First of all actual components visible bounds have to be determined. I have found code to do that in private function of MaskEffectInstance class from Flex 3 framework. As I believe that such code shouldn’t be rewritten every time someone need it I have created utility class named ComponentUtils and copied code from MaskEffectInstance to a public static function.
Knowing what are the visible bounds of the component I have discovered that x and y coordinate of visible rectangle are often negative (when filter is drawn at the left or above component). According to DisplayObjec documentation when scrollRect property is set the visible area upper-left corner is defined by components (0,0) point. So to enable displaying of filtered component (e.g. shadow) at the left or above component I had to move component there and back as described in next two paragraphs.
Moving component (up/left) so that its origin (0,0 point) equals to visible rectangle upper-left corner
To move component origin to visible rectangle origin I have adjusted its x and y coordinates in effect instance play() function:
target.x += visibleRect.x; target.y += visibleRect.y
I have also remembered to restore component to its original position at effect end (onTweenEnd() function):
target.x -= visibleRect.x; target.y -= visibleRect.y
Moving component content back (down/right) so that it is displayed at the original location
To balance component movement I have adjusted scrollRect x and y coordinates in concrete effect instance onTweenUpdate functions. If these values are set to negative values (visible rectangle x,y) component is moved right-down. After applying this changes effect seems to work as before but shadows are visible.