2 Replies Latest reply on Sep 29, 2009 12:04 PM by gloam

    Finding out what composition an element is a child of

    gloam

      I've been experimenting with different ways of using the layout API and have run into a situation where I'd like a reference (IMediaReferrer) plugin to make itself part of the same composition that its target media element is in.  This is so that it is always laid out properly relative to the target.

       

      There doesn't seem to be an OSMF composition equivalent of the AS3 DisplayObject.parent property, which allows you to find out what the parent of a child is.  Would it make sense to add this as part of an ICompositable interface for Media Elements, as a property on the LayoutFacet classes, or something similar?  Or is there a better way to go about the the goal of keeping a reference plugin within the same layout container as it's target media element?

       

      Thanks.

        • 1. Re: Finding out what composition an element is a child of
          Edwin van Rijkom

          Hi Gloam,

           

          That's a very good question. I don't see a straight forward way to do that with the current APIs.

           

          The reason that we have not added an owner/parent property on media element is that we wanted to avoid having a circular reference between the child and the container. We've refrained from doing an IComposed trait interface because we wanted the reserve traits for aspects that are core to the media (where parent info is more contextual in nature).

           

          Up until now, we've always managed to do without the parent referece, however, the use case you've put forward did not come up before. We'll have to flesh out a solution for this for the sprints to come.

           

          Cheers,

          Edwin

          1 person found this helpful
          • 2. Re: Finding out what composition an element is a child of
            gloam Level 1

            Thanks, Edwin.

             

            Makes sense.  I'm experimenting to see if there is another way to achieve my use case.  Currently I'm having some success using a ProxyElement.  When I get a video passed in as the wrapped element, I create a parallel element and add the video and my swf overlay and set the whole composition as the wrapped element.  I'm able to get the desired functionality of locking the overlay positionally and dimensionally to the video.  What remains to be explored is how well this arrangement works when passing through calls / listeners that are intended for the video element.  I'm not sure how they will be handled by a parallel element consisting of a SWFElement and VideoElement.

             

            I'll let you know what I find....