简体   繁体   English

AS3-放大图片?

[英]AS3 - Zoom in image?

=) =)

So, I need to be able to zoom in on my image, but I cant get it to work properly. 因此,我需要能够放大我的图像,但是我无法使其正常工作。

I've got an Image showing my content, and it get it's content from a BitmapData. 我有一个显示我的内容的图像,它是从BitmapData获取的内容。

The BitmapData is full-res, which is 2880x1620, and the Image is scaling to fit my window. BitmapData是全分辨率的,为2880x1620,并且图像正在缩放以适合我的窗口。

The SmoothImage is the same as Image, but with smoothing added. SmoothImage与Image相同,但添加了平滑功能。

<me:SmoothImage id="imageFull" visible="false" width="100%" height="100%" />

How would I go about zooming this image when I scroll my mouse? 滚动鼠标时如何缩放此图像?

This is the code I have, and it does change the scaling factor. 这是我的代码,它确实会更改缩放比例。 But since it's set to fit my view, nothing happens... 但是由于它已经适合我的观点,所以什么也没有发生...

        public function videoBufferWheel(event:MouseEvent):void{
            myZoom += (event.delta/10);

            if(myZoom >=1){
                imageFull.scaleX = myZoom;
                imageFull.scaleY = myZoom;
            }else{
                myZoom = 1;
            }
        }

It can not scaling because a element gets its maximum size (100%). 它无法缩放,因为元素会达到其最大大小(100%)。 You can increase this image only by set an attribute fillMode="clip". 您只能通过设置属性fillMode =“ clip”来增加此图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM