hi,
thx for the advice.

1. programmatically adding video to stage:
<mx:Box id="videoContainer" borderStyle="solid"/>

 var videoContainer_:UIComponent = new UIComponent();
 videoContainer_.addChild(video);
 videoContainer.addChild(videoContainer_);

2. as component
Main.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
 xmlns:s="library://ns.adobe.com/flex/spark"
 xmlns:mx="library://ns.adobe.com/flex/mx"
 creationComplete="CameraExample();" xmlns:test="test.*"
 >

 <mx:VBox width="100%" height="100%" id="CONTAINER" horizontalAlign="center" verticalAlign="middle" borderStyle="solid">
 <mx:Button label="button1"/>
 <mx:Box borderStyle="solid">
 <test:CameraUIComponent id="video" width="640" height="480"/>
 </mx:Box>
 <mx:Button label="button1"/>
 </mx:VBox>

 <fx:Declarations>
 <!-- Place non-visual elements (e.g., services, value objects) here -->
 </fx:Declarations>
 <fx:Script>
 <![CDATA[
 public function CameraExample():void
 {
 video.CameraExample(640,480,10);
 }
 ]]>
 </fx:Script>
</s:Application>
</code>

CameraUIComponent.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent xmlns:mx="http://www.adobe.com/2006/mxml" width="{video.width}" height="{video.height}">
 <mx:Script>
 <![CDATA[
 import flash.display.Sprite;
 import flash.display.StageAlign;
 import flash.display.StageScaleMode;
 import flash.events.*;
 import flash.media.Camera;
 import flash.media.Video;

 import mx.managers.SystemManager;

 public var video:Video = new Video();
 public var camera:Camera;
      
 public function CameraExample(height:Number = 640,width:Number = 480,frameRate:Number = 25) {
 systemManager.stage.scaleMode = StageScaleMode.NO_SCALE;
 // systemManager.stage.align = StageAlign.TOP_LEFT;

 camera = Camera.getCamera();
 camera.setMode(height,width,frameRate,false);

 if (camera != null) {
 camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
 video.width = camera.width;
 video.height = camera.height;
 video.attachCamera(camera);
 addChild(video);
 } else {
 trace("You need a camera.");
 }
 }

 private function activityHandler(event:ActivityEvent):void {
 trace("activityHandler: " + event);
 }

 override protected function createChildren():void
 {
 super.createChildren();
 video = new Video();
 addChild( video );
 // view.addEventListener(Event.ADDED_TO_STAGE, update); // Make sure the first frame is rendered
 }

/*             override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
 {
 super.updateDisplayList(unscaledWidth, unscaledHeight);
 }
 */        ]]>
 </mx:Script>
</mx:UIComponent>

admin