1

I am trying to mirror the camera display in my mx:VideoDisplay object in Flex 3.6. That is, I want the camera image to be flipped horizontally.

This is my MXML file:

<?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>

I have tried to use myWebcam.scaleX="-1" and adding myWebcam.x = myWebcam.width among many further combinations without success.

So, how am I supposed to flip the image?

Thanks

MobileCushion
  • 7,065
  • 7
  • 42
  • 62
  • Can you get a reference to myWebcam's videoPlayer object? If so, you might be able to set scaleX on that. – Brian Nov 21 '13 at 17:02
  • If everything fails, you could still draw the videodisplay to a bitmap, then loop through the bitmap's columns (1px every time) and draw them to another bitmap from right to left. Then add the bitmap instead of the videodisplay. I assume this will be more CPU intensive than pure video but something is something. – Fygo Nov 21 '13 at 17:16

1 Answers1

0

You can change:

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

to:

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

I also found that myWebcam.scaleX = -1 is not ok, maybe it is a bug.

BearPy
  • 322
  • 5
  • 7