开发者

Static Mask with Moveable Content

I'm having trouble figuring out how to make a static mask with dynamic content (as in a picture you can zoom/pan) in ActionScript. I've seen a lot of the opposite (see here), where you have static content (like an image) and a dynamic mask on top that you can manipulate. I would like to do the opposite - have a static mask (set at some size at some area) wi开发者_高级运维th dynamic content underneath. So for example, a user could zoom in/drag around some content, and the display size wouldn't change, while the content would move. You could imagine Google Maps being confined to a smaller square and being able to zoom in/manipulate the map through that square, and have whitespace outside of that square.


You can make two things:

1) If the mask is made in design time in Flash Professional, you can set the mask as a Sprite or a MovieClip, give the mask an instance name, and then in runtime by code call addChild()/removeChild() on the mask as appropiate.

2) If the mask is instantiated at runtime, you just call setMask() on the DisplayObjects that need to be masked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜