开发者

keep image inside a frame

开发者 https://www.devze.com 2022-12-17 21:19 出处:网络
Hi can anyone help me with a problem please. I am not looking for anybody to write code for me but just give me a few pointers.

Hi can anyone help me with a problem please. I am not looking for anybody to write code for me but just give me a few pointers. I want to to put a frame or border around an image in actionscript3. I want to use an image that is considerably bigger than the border. the effect would be that the image would move around but only show what is inside the bord开发者_如何学运维er. similar to looking through a keyhole ?? my best effort was to do a reverse mask, where the mask did not move but without success. If anyone has any idea's I would be very grateful

Thanks


yes you will need a mask for this. put the image inside the mask and then draw a border around your mask and put it onto of that. I'm speaking of the layer structure inside the timeline you don't need to write code for this (well, maybe for the animation...).


you need to create a holder for the image and a mask then set the holder mask to the mask:

imgHolder.mask = imgMask;

then add a listener to the image like this:

imgHolder.addEventListener(MouseEvent.MOUSE_DOWN, startImageDrag);

then in the startImageDrag function you can move the image around inside the mask

0

精彩评论

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