8 Replies Latest reply on Sep 21, 2010 11:15 AM by ionflow

    LayoutMetadata Ignored With Parallel Elements

    ionflow Level 1

      I'm having difficulty getting my parallel data to scale properly. Here's my execution:



      private function createMediaElement():MediaElement



           var layoutMetada:LayoutMetadata = new LayoutMetadata();

           layoutMetadata.scaleMode = ScaleMode.LETTERBOX;

           layoutMetadata.horizontalAlign = HorizontalAlign.CENTER;

           layoutMetadata.verticalAlign = VerticalAlign.TOP;

           layoutMetadata.top = 0;

           layoutMetadata.left = 0;

           layoutMetadata.right = 0;

           layoutMetadata.bottom = 100;


           var resource1:StreamingURLResource = new StreamingURLResource(BASE_STREAM_URL + REMOTE_STREAM1, null, 0, 5);

           var videoElement:VideoElement = new VideoElement( resource1 );

           videoElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);

           var swfElement:SWFElement = new SWFElement( new URLResource(BASE_PROGRESSIVE_URL + REMOTE_SWF1) );

           swfElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);

           var durationElement:DurationElement = new DurationElement( 5, swfElement );

           durationElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);

           // First child is an swf overlayed for 3 seconds onto a streaming video.

           var parallelElement:ParallelElement = new ParallelElement();

           parallelElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);

           parallelElement.addChild( videoElement );

           parallelElement.addChild( durationElement );


           var serialElement:SerialElement = new SerialElement();    

           serialElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);

           serialElement.addChild( parallelElement );


           // second child is a video.

           serialElement.addChild( mediaFactory.createMediaElement( new URLResource(BASE_PROGRESSIVE_URL + REMOTE_STREAM2) ) );


           return serialElement;




      The SWF loads in scaled to fit the Sprite bounds, but when the video loads and starts playing, both the SWF and video resize smaller to match the video's original width and height. They no longer scale. Am I putting the metadata assignments in the wrong place or at the wrong time?