title: Resize flash.media.Video
body: <p>I'm having trouble to resize my custom <code>UIComponent</code> that wrap <code>flash.media.Video</code> object (The reason I choose this way is because <code>mx.control.VideoDisplay</code> doesn't support streaming playback that available in <code>flash.media.Video</code> that is <code>attachNetStream()</code>). Once I create a 320x240 <code>Video</code> size and remove it from its parent, I can't replace it with another one, bigger or smaller.</p>
  
  <p>Here's my code (this one only capture Camera not NetStream).</p>
  
  <pre><code>package media
  {
      import flash.media.Camera;
      import flash.media.Video;
  
      import mx.controls.VideoDisplay;
      import mx.core.UIComponent;
  
      public class VideoUI extends UIComponent
      {
          private var video:Video;
  
          public function VideoUI(width:int, height:int)
          {
              super();
              video = new Video(width, height);
              var cam:Camera = Camera.getCamera();
              video.attachCamera(cam);
              addChild(video);
          }
      }
  }
  </code></pre>
  
  <p>The other part,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt;
      &lt;mx:Script&gt;
          &lt;![CDATA[
              import media.VideoUI;
  
              private function addVideoOutput():void
              {
                  // initial video size
                  var video:VideoUI = new VideoUI(160,120);
                  HBoxVideo.addChild(video);              
              }
  
              protected function resizeVideo(event:MouseEvent):void
              {
                  var videoList:Array = HBoxVideo.getChildren();
                  for (var i:int = 0; i &lt; videoList.length; i++)
                  {
                      var video:VideoUI = videoList.pop();
                      HBoxVideo.removeChild(video);
                      // new size that produce the previous size :(
                      video = new VideoUI(320, 240);
                      HBoxVideo.addChild(video);
                  }
              }
  
          ]]&gt;
      &lt;/mx:Script&gt;
      &lt;mx:Button click="addVideoOutput()" x="10" y="265" label="add"/&gt;
      &lt;mx:HBox x="10" y="10" width="100%" id="HBoxVideo"&gt;
      &lt;/mx:HBox&gt;
      &lt;mx:Button x="58" y="265" label="resize" click="resizeVideo(event)" id="resizeButton"/&gt;
  &lt;/mx:Application&gt;
  </code></pre>
  
  <p>Thank you very much.</p>