0 Replies Latest reply on Apr 26, 2010 10:51 PM by shrelp

    Using SMILElement


      So lets say the SMILPlugin is loaded and you need to create a Media element by invoking mediaFactory.createMediaElement.



      mediaFactory.addEventListener( MediaFactoryEvent.MEDIA_ELEMENT_CREATE, handle_mediaElementLoaded);
                     var resource:URLResource = new URLResource("http://mediapm.edgesuite.net/osmf/content/test/smil/elephants_dream.smil");
                     mediaElement = mediaFactory.createMediaElement(resource);



      Now in the handler you should receive a SMILElement in the event.  Now from my understanding you add this SMILElement to the mediaPlayer via the media method.


      var smilElement:SMILElement = e.mediaElement as SMILElement;
      mediaPlayer.media = smilElement;


      Then you should be able to add the damn mediaPlayer.displayObject to the display list  but in my case the displayObject is null.

      • I've looked for events that signal the displayObject was created from the MediaPlayer, MediaFramwork and all the other actors.

      • I stepped through the SMILLoader and everything appears to have been created correctly.

      • I looked for events coming form the LoadedFromDocumentElment class but from what I can see the SMILElement is loaded.


      So what am I missing here, why can't I add the SMILElement to a MediaPlayer?


      Here is what the SMILElement looks like on the handling MediaFactoryEvent.MEDIA_ELEMENT_CREATE.

      Picture 2.png