2 Replies Latest reply on Sep 13, 2010 3:16 AM by DanielPopescu

    Video object & auto-resize


      Hi, I need to add at run-time a video object to a panel, making sure its size matches panel's.

      The spark videoDisplay object has some nice percentualHeight and percentualWidth attributes, but the problem is that I cannot attach webcam and netstream to it, which is what I really need, on the contrary the Video object allows me to attach webcam/netstream but has not percentualHeight and percentualWidth attributes.

      Is there a way to solve this problem?

        • 1. Re: Video object & auto-resize
          Squall86 Level 1

          No one?T_T

          • 2. Re: Video object & auto-resize

            Use the resize event handler of your video object holder and set the new size.


            <?xml version="1.0" encoding="utf-8"?>
            <!-- Copyright (c)- 2010 Daniel Popescu -->
            <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
                     width="100%" height="100%"
                     creationComplete="group_creationCompleteHandler(event)" >
                        import mx.events.FlexEvent;
                        import mx.events.ResizeEvent;
                        private var video:Video;


                        protected function group_creationCompleteHandler(event:FlexEvent):void
                            video = new Video(holder.width, holder.height);


                        protected function holder_resizeHandler(event:ResizeEvent):void
                                video.width = holder.width;
                                video.height = holder.height;


                <mx:UIComponent id="holder"
                                width="100%" height="100%"
                                resize="holder_resizeHandler(event)" />