0
votes

Is it possible to Cast the DisplayObject into MediaElement.Am trying to add the DisplayObject into the MediaContainer, but I got the following error:

-1067: Implicit coercion of a value of type flash.display:Loader to an unrelated type org.osmf.media:MediaElement. -mediaContainer

_loader is the variable of DisplayObject.

mediaContainer.addMediaElement(_loader);

How can I rectify this problem? I am using Flash Builder4.

1

1 Answers

0
votes

You can only add descendants of the MediaElement class using MediaContainer.addMediaElement(). A Loader is not related to MediaElement, so it cannot be added directly. Instead, you will need to create a MediaElement and add your Loader as a trait. This requires you to use one of the OSMF loading classes instead, and which one you choose will depend on the type of content you are loading.