Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
slaingod #1
attachCamera issue: Tiny size
I'm having a weird issue. I have a Proof of Concept app that had issues with
the video area for a live camera showing at 10x10 on both a Mac & PC. I was
able to use scaleX/scaleY to make it a reasonable size, but the quality suffers
somewhat (it is better than 10x10 simply resized, but moderate pixelation). I
eventually switched my code around a little and got things to work (no idea
what fixed it). Now I am seeing the same behavior in the same code in the full
application. Was wondering if anyone had any ideas.
private function onConnectWebcam():void {
camera_status.text = "";
if (Camera.names.length > 0 && video == null)
{
if(Camera.names.length > 1) {
// show camera chooser
}
// but always connect to default
onCameraChoosen(Camera.names[0]);
}
else
{
camera_status.text = "No webcam was found. Please connect a webcam and try
again.";
}
}
private function onCameraChoosen(camName:String):void {
onDisconnectWebcam();
videoHolder = new UIComponent();
cam = Camera.getCamera(); //(camName) Always connect to default per Adobe
Docs
if(cam) {
cam.addEventListener(StatusEvent.STATUS, attachHandler);
cam.setMode(480, 360, 30);
video = new Video(cam.width, cam.height);
video.attachCamera(cam);
videoHolder.addChild(video);
// I HAVE TO SCALE HERE TO GET 10x10 to work
videoHolder.scaleX = 48;
videoHolder.scaleY = 36;
video_canvas.addChildAt(videoHolder,0);
} else {
camera_status.text = "Unable to connect to webcam. Perhaps it is busy?";
}
}
Here is the mxml portion its own component. The video_canvas is the container
for the videoHolder component:
<mx:Canvas id="webcam" visible="false" y="64" x="14">
<mx:Canvas backgroundColor="#FFFFFF" width="500" height="380">
<mx:Canvas id="video_canvas" width="480" height="360" x="10" y="10"
backgroundColor="#000000" clipContent="true"/>
<mx:Image id="webcam_image" width="480" height="360" x="10" y="10"/>
<mx:Text id="camera_status" color="#FFFFFF" x="88" y="88" width="310"
height="182" fontSize="20" textAlign="center"/>
</mx:Canvas>
</mx:Canvas>
This is the WORKING proof of concept code, which I can't really tell has any
differences, other than nesting of the video_canvas:
private function onComp():void {
if (Camera.names.length > 0)
{
videoHolder = new UIComponent();
cam = Camera.getCamera();
cam.setMode(480, 360, 30);
video = new Video(cam.width, cam.height);
video.attachCamera(cam);
videoHolder.addChild(video);
video_canvas.addChild(videoHolder);
}
else
{
trace("User has no cameras installed.");
}
}
<mx:Application...
<mx:Canvas id="video_canvas" height="360" width="480" clipContent="true"/>
slaingod Guest
-
AttachCamera
Is there a way to completely detach from your local camera once you have accepted it in the Flash player without closing the swf? ie So another... -
PDF file size issue
I've created two separate versions of the same basic 400 page file in Quark. The first uses a single 700K eps file 3 times on each page and creates a... -
Tiny, wrong size, PDF images
Lori, Jacko, how are you creating your PDF's? What software are you creating from, Quark, in-Design????? What is the final Purpose of the PDF,... -
EPS size issue
I use FH10 as my design tool of choice. I just got a copy of an EPS from a sign co to use. It was 30000 x 30000 pixels. Freehand wouldn't open... -
(Tiny) Size issues with laptop WUXGA screen
Harv, Yes, I have tried setting the display to a lower resolution. Text and graphics look fuzzy, though. Why? Because laptop displays have one... -
slaingod #2
Re: attachCamera issue: Tiny size
I've actually narrowed it down to a single thing: Adding any VideoDisplay
component bugs out the camera. Anyone else ever seen this or know of a
workaround?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onComp()"<mx:Script>>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.core.UIComponent;
private var cam:Camera;
private var video:Video;
private var videoHolder:UIComponent;
private function onComp():void {
if (Camera.names.length > 0)
{
videoHolder = new UIComponent();
cam = Camera.getCamera();
cam.setMode(320, 240, 30);
video = new Video(cam.width, cam.height);
video.attachCamera(cam);
videoHolder.addChild(video);
video_canvas.addChild(videoHolder);
}
else
{
trace("User has no cameras installed.");
}
}
]]>
</mx:Script>
<mx:Canvas id="video_canvas" height="240" width="320" clipContent="true"/>
<mx:VideoDisplay /> <!-- Remove this line and the problem goes away -->
</mx:Application>
slaingod Guest
-
slaingod #3
Re: attachCamera issue: Tiny size
Looks like plain old
VideoDisplay.attachCamera works here...it is the combo of the 2 that screws
things up. I originally switched to just Video because I was seeing the same
thing with VideoDisplay...weirdness. Maybe two different problems, because I
did reinstall my cam drivers after switching to vid.
slaingod Guest



Reply With Quote

