如何在Flex中的VideoDisplay中镜像相机显示

时间:2013-11-21 12:27:53

标签: actionscript-3 flash flex flash-video

我正在尝试在Flex 3.6中的mx:VideoDisplay对象中镜像相机显示。也就是说,我希望水平翻转相机图像。

这是我的MXML文件:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
                layout="absolute" applicationComplete="init()"
                xmlns:ns1="components.*" 
                xmlns:ns2="*"
                xmlns:fl="flash.media.*"
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:gauge="components.gauge.*"
                >
<mx:Script source="script.as" />
<mx:Style source="style.css" />
        <mx:Canvas label="recorder" width="100%" height="100%" verticalScrollPolicy="off" 
            horizontalScrollPolicy="off" id="canvas2">
            <mx:VideoDisplay id="myWebcam"  scaleX="1"  left="0" top="0" bottom="36" right="0"/>
            <mx:Image id="mask2" source="@Embed(source='assets/mask.png')"                          
                    left="190" top="120" width="270"/> 
    <ns1:VideoContainer right="0" bottom="0" /> 
</mx:Application>

我尝试使用myWebcam.scaleX="-1"并在许多其他组合中添加myWebcam.x = myWebcam.width但未成功。

那么,我该如何翻转图像?

由于

1 个答案:

答案 0 :(得分:0)

您可以更改:

<mx:VideoDisplay id="myWebcam"  scaleX="1"  left="0" top="0" bottom="36" right="0"/>

为:

<mx:VideoDisplay id="myWebcam"  scaleX="-1"  left="0" top="0" bottom="36" right="0" x="{myWebcam.width + myWebcam.x}"/>

我还发现myWebcam.scaleX = -1不行,也许是个bug。

相关问题