2012-08-22 110 views
0

嗨,这会杀死我:)我使用asocular as3移动,旋转,缩放,偏斜加载图像到MC和伟大的工程,但花了很多时间,找不到好的解决方案用鼠标剪切这种MC(带有加载的图像)。有人有解决方案(代码)吗?as3裁剪图像加载为MC

+0

你想只显示图像,如果它被裁剪,或者你需要改变(然后保存)的实际图像? – JcFx

+0

当加载图像时,我需要可以左右/上/下移动两侧的盒子,并且在那个方向上停留在舞台上的作物MC – Simon

+0

或者用简单的词语,像变形的senocular http://www.senocular.com/ flash/tutorials/transformtool /,这正是我需要在舞台上剪裁MC的 – Simon

回答

1

要显示裁剪区域,您只需应用一个遮罩,该遮罩只是另一个显示对象。

我还没有使用Senocular的代码,但如果你使面具他的移动/比例代码的目标,那么你可以很容易地实现裁剪。在Adobe文档中有很多掩码:http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_28.html

实际上,在裁剪时必须隐藏调整大小/移动控件,反之亦然,这就是为什么Flash本身或Photoshop等工具具有单独的变换和裁剪的原因模式。

从Senocular的文档:

// import for the Transform Tool classes used 
import com.senocular.display.transform.*; 

// create a box object to interact with 
var box:Sprite = new Sprite(); 
addChild(box); 
box.graphics.beginFill(0xAACCDD); 
box.graphics.drawRect(-50, -50, 100, 100); 
box.x = 100; 
box.y = 100; 

// create the Transform Tool 
var tool:TransformTool = new TransformTool(new ControlSetStandard()); 
addChild(tool); 

// select the box with the transform tool when clicked. 
// deselect when clicking on the stage 
box.addEventListener(MouseEvent.MOUSE_DOWN, tool.select); 
stage.addEventListener(MouseEvent.MOUSE_DOWN, tool.deselect); 

只要做到这一点,但需要在你的影片剪辑的面具,这样,当你调整它,你会裁剪影片剪辑。

+0

呵呵,有没有例子?如果我明白我需要:1)添加mc 2)添加蒙版到形状3)移动边界框时获取鼠标线4)使用mc蒙板上的坐标进行操作? – Simon

+0

Simon - 我在限期内,我没有时间为你整理一个完整的例子。是:1)添加mc,2)添加遮罩,3)将Senocular的调整大小手柄添加到遮罩,以便用户调整大小,4)限制比例,以便它们只能在MC的边界内调整遮罩大小,5)当蒙版被调整大小时,可见MC被裁剪。 – JcFx

+0

好的,非常感谢,一切都很好,只要告诉我如何“将Senocular的调整大小手柄添加到面具”,我不知道该怎么做? – Simon