2 Replies Latest reply on Jul 19, 2010 10:01 AM by Dominic Farmer

    Updating LayoutMetadata

    Dominic Farmer



      A few things are confusing me about updating the LayoutMetadata.


      I'm using a parallelElement and want to be able to toggle the elements which make up the parallelElement to being 100% of the size of the mediaPlayer and back down again. To do this, I'm getting the metadata from the videoElement I want to make 100%, updating it to and then whne the button is clicked agin, setting it back again.


      I have a couple of questions/ problems:


      1. At first I made a mistake and set layout.x =0 to put it in the top left corner, then used percentX to put it back. It didn't go back, presumabaly because if both percentX and x exist in the metadata then x will win. I guess this is by design, but I thought I'd point it out.


      2. A bigger issue is that when resize a videoElement in the parallelElement, the parallelElement resizes down. I think it goes down to the native size of the video. I have sizes set to percentages, so if I stretch my window, it sorts itself out again, which means I know it works in principle. Do I have to do anything after resizing an element inside a parallelElement to get the parallelElement back to size?


      I'm absolutely (well, you know, as absolutley as it gets) sure that there is nothing in my code which resets the size of the main parallelElement or media player when I resize one of it's mediaElements. In fact pretty much everything is on % sizes in any case...


      An pointers would be greatly appreciated.




        • 1. Re: Updating LayoutMetadata

          Can you post a simple code of your app and your expected behavior so that we can take a look?



          • 2. Re: Updating LayoutMetadata
            Dominic Farmer Level 1

            Hi Ryan,


            Thanks for the quick reply. I changed approach and I'm now trying a proxyelement instead, but I'm hitting a different issue.


            I have several videos (A, B and C) and create a synchronisedParallelElement (copied the code straight from the examples)

            I create a proxyElement and set the proxiedElement to the parallelElement.


            Plays fine A, B and C arranged on page.


            I put in some code which switches the proxiedElement so it proxies one of the videos (B) which was the source of the parallelElement.


            Play fine. B replaces the A,B,C combination on screen and continues playing seamlessly.


            I then try to set the proxiedElement back to the synchronisedParallelElement to play A,B,C on screen and I get an error as below:

            ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

            at flash.display::DisplayObjectContainer/removeChild()

            at org.osmf.layout::LayoutTargetSprite/onRemoveChild()[C:\Dev\osmf\public\trunk\framework\OS MF\org\osmf\layout\LayoutTargetSprite.as:376]



            If I let it continue, I can see that the video which i switched into the proxyElement (B) is missing from my parallelElement.


            So I tried building a parallelElement out of proxyElements, having them proxy A,B,C  (worked fine) and then switching the B proxy back before switching back to the parallelElement (phew!) This resulted in the error above.


            So I'm wondering if there's a different approach? Maybe I should use two players and proxy into them - but the problem seems to be that when you use a video that's in a parallelElement it is taken out of the parallelElement, so I suspect I need to put it back somehow to get this work...


            I'm wondering if this is expected behaviour and if anyone can think of a workaround...


            Not sure if you'd still like to see code (if so I'll need to do some de-complication to get minimum conditions...)