7 Replies Latest reply on Mar 9, 2010 3:51 PM by bringrags

    LayoutUtils.setAbsoluteLayout confusion

    jerryhamby Level 1

      Help me understand LayoutUtils.setAbsoluteLayout, it seems to work differently when

      you pass in metadata from a single element than from a SerialElement. The single version

      works just fine, the serial doesn't.

       

      SINGLE:

      TRACE: mMediaSizeChange pMediaElement.metadata =  [object Metadata]

       

      SERIAL:

      TRACE: mMediaSizeChange pMediaElement.metadata =  [object CompositeMetadata]

      I don't see any docs for CompositeMetadata inside org.osmf.metadata. I do see docs on Metadata.

       

      I run each item through some custom resize code and it gives me back an array of width, height, x, y

      I need for this to work for both single and serial.

       

      function mResizeAndMaintainAspectRatio(vOrgWidth:Number, vOrgHeight:Number, vTargetWidth:Number, vTargetHeight:Number):Array {

       

      LayoutUtils.setAbsoluteLayout( pMediaElement.metadata, vArray[0], vArray[1], vArray[2], vArray[3]);

        • 1. Re: LayoutUtils.setAbsoluteLayout confusion
          Edwin van Rijkom

          Hi Jerry,

           

          There should not be any difference between setting layout properties for atomic and composite elements. It is true that composites use a different metadata subclass (CompositeMetadata), but that should not have any influence on how the layout system works.

           

          I'm not exactly sure what problem you are running into: could you perhaps post a small sample app?

           

          (Just as a heads-up: the layout APIs have been changes quite a bit over the last two weeks. You'll find that the samples on the trunk no longer use LayoutUtils, but a class called LayoutProperties instead.)

           

          Cheers,

          Edwin

          • 2. Re: LayoutUtils.setAbsoluteLayout confusion
            jerryhamby Level 1

            I have attached a test file:

             

            1- The stage is set to 320x480

             

            2- make sure at least 2 of the images are larger size than the stage

             

            3- play each of the images separately through ImageElement

                to see proper results

             

            4- uncomment the serialElement code,  then run. You should see the

                 images are not resizing properly.

             

            5- watch the trace numbers when the SerialElement runs,

                the resize numbers are correct but LayoutUtils does not obey

                the correct numbers

            • 3. Re: LayoutUtils.setAbsoluteLayout confusion
              jerryhamby Level 1

              I have done some more testing and found another problem,

              I've added the additional code to the attached sample FLA.

               

              The problem is that the TimeEvent.COMPLETE event is not firing

              after I play a SerialElement with 3 videos.

               

              pPlayer.addEventListener(TimeEvent.COMPLETE,mComplete);

               

              The sample SerialElement containing 3 images,

              does fire correctly on the TimeEvent.COMPLETE event.

              It just has the other problem, I mentioned in the previous post.

               

              Now I'm more confused, I just don't know if it's a bug or my coding.

              Tested against Sprint 9.

              • 4. Re: LayoutUtils.setAbsoluteLayout confusion
                jerryhamby Level 1

                I can't seem to get any love from the OSMF team on this one,

                this is a MediaContainer issue and needs to be looked at.

                 

                I have filed a bug:

                FM-451

                "LayoutUtils.setAbsoluteLayout does not obey correct numbers"

                • 5. Re: LayoutUtils.setAbsoluteLayout confusion
                  Edwin van Rijkom Level 2

                  Thank you for filing this as a bug. We're currently pretty much heads-down on getting the Sprint 10 release out of the door: appriciate your patience!

                   

                  Cheers,

                  Edwin

                  • 6. Re: LayoutUtils.setAbsoluteLayout confusion
                    jerryhamby Level 1

                    FYI, looks like bug FM-451 is fixed in Sprint 10.

                    Little bit verbose, but I think a lot more control.

                    Works nicely on my SerialElement.

                     

                    OLD CODE:

                    LayoutUtils.setAbsoluteLayout(pMediaElement.metadata, vArray[0], vArray[1], vArray[2], vArray[3]);

                     

                     

                    NEW CODE:

                    var vLayout:LayoutMetadata = new LayoutMetadata();

                    pMediaElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, vLayout);

                    vLayout.width=vArray[0];

                    vLayout.height=vArray[1];

                    vLayout.left=vArray[2];

                    vLayout.top=vArray[3];

                    • 7. Re: LayoutUtils.setAbsoluteLayout confusion
                      bringrags Level 4

                      That's great to hear.  I've marked the bug as fixed in the bug app.