2 Replies Latest reply on Mar 15, 2010 3:42 PM by jerryhamby

    This is getting really old

    jerryhamby

      This is getting really old. 

      I keep running into limits on the way I can access information.

       

      I have some code that was looking at a SerialElement:

      pSerialElement.getChildAt(0).toString();     trace produces "[object VideoElement]"

       

      Now if I simply store that SerialElement in a MediaElement (pMediaElement = pSerialElement )

      I no longer can do a getChildAt.

      trace pMediaElement = [object SerialElement]   (it says it's a SerialElement)

      trace pPlayer.media = [object SerialElement]

      1061: Call to a possibly undefined method getChildAt through a reference with static type org.osmf.media:MediaElement.

       

      You encourage us to use MediaElement, yet you lock us out of inspecting our elements

      once inside the MediaElement.

       

      I want read-only access to the objects inside of MediaElement.

      I should be able to inspect the SerialElement no matter which way it's stored.

       

      I honestly don't understand the logic, on an open source project, to locking everything down

      so tight with private vars.

        • 1. Re: This is getting really old
          bringrags Level 4

          This isn't an OSMF limitation, it's how AS3 works.  To access the method of a subclass (e.g. SerialElement.getChildAt), you have to cast the object to that subclass, e.g.:

           

          trace ((mediaElement as SerialElement).getChildAt(0));

          • 2. Re: This is getting really old
            jerryhamby Level 1

            Yes, this type casting you had mentioned before, just didn't stick in my memory.

            Sorry for the late night rant.

             

            I'm now getting the results I wanted, thanks again for your patience.

             

            trace(pMediaElement);

            result:  [object SerialElement]

             

            trace(pPlayer.media);

            result:  [object SerialElement]

             

            trace ((pPlayer.media as SerialElement).getChildAt(0));

            result:  [object VideoElement]

             

            trace ((pMediaElement as SerialElement).getChildAt(0));

            result:  [object VideoElement]

             

            trace ((pMediaElement as SerialElement).getChildAt(0).resource);

            result:  [object URLResource]

             

            var vResource:URLResource = ((pMediaElement as SerialElement).getChildAt(0).resource as URLResource);

            trace (vResource.url);

            result:   ./media/walkin.flv