Skip to main content

Scale9Grid with Masking

ActionScript DisplayObject has a property called scale9grid used to scale objects according to nine regions based rectangle, detailed information could be found here

One day I was trying to use it for scaling effect applied to a MovieClip with curved corners and dynamic loaded image within, the problem was that the mask didn’t scale properly using scale9grid ..
I didn’t find an answer to why not, this post on Kirupa still has no reply, and I was using ActionScript 2.0

Well, I used a work-around way to bypass this issue, it’s simple, just leaving the mask with sharp corners with no scale9grid applied, and draw extra border that has the same background color to hide the image corners visually!
this won’t work nice unless we have only solid background color

hiding image corners
hiding image corners

I was hoping that adobe fixes this issue in AcrionScript 3.0, but unfortunately they didn’t ..

Few days ago I found this post at Mark Grossnickle’s blog, his custom Scale9Mask works fine with masked objects, but it has to be applied individually, and there’s a scaling factor issue, here is a demonstration example with source code available via flash context menu

Many thanks to Mark Grossnickle ..