7 Replies Latest reply on Jan 21, 2010 9:39 AM by gregbown

    SWFElements & ImageElements not unloading on set element

    gregbown

      I originally was using a serial element to handle the loading and unloading however due to being unable to seek on a serial element with the current code release or latest from svn (http://forums.adobe.com/thread/552041?tstart=0) I opted to set MediaPlayer element directly for navigating. I now have another issue with the SWFElement or ImageElement not unloading.

       

      If I load VideoElements it seems to work fine however ImageElements and SWFElements stay on display and obscure video elements.

      According to the documentation it should remove the prior element when the new element is set.

       

      I even tried to unload them manually with:

                          if(view.mediaContainer.element != null && view.mediaContainer.element.container){
                              view.mediaContainer.element.container.removeMediaElement(view.mediaContainer.element);
                          }

      I am using the latest from svn because I am trying to get somthing together I can demo. ( I could not get release .8 to work as stated in my other post ). It is dificult to pitch OSMF when the workaround is almost as bad. I am still hopefull though. Any ideas on how to get navigation working in release .8 or svn trunk would be helpful.  Not sure if I should post another bug?

       

      Thank you

      Greg

        • 1. Re: SWFElements & ImageElements not unloading on set element
          Vijay Ghaskadvi

          Hi Greg,

           

          I've logged a bug for the seeking issue in TemporalProxyElement - I'll keep you posted on it.

           

          I don't fully understand the unloading issue you mention. I tried setting a SerialElement on the media player with a SWF (wrapped inside a TemporalProxyElement) followed by a VideoElement, and the SWF got unloaded correctly. Do you encounter this problem when you call 'set media()' on MediaPlayer with the VideoElement? Could you post a smaller code sample that reproduces the unloading issue?

           

          One other thing you might try is to log the value of the 'canLoad' property before you set the new MediaElement. It is what determines whether the MediaPlayer will do a courtesy unload of the previous media element (it should return 'true', but just want to make sure). Alternatively, you can force an unload of the previous element by explicitly calling 'unload' on the LoadTrait as follows:

           

           

           

          var loadTrait:LoadTrait = player.media.getTrait(MediaTraitType.LOAD) as LoadTrait;

           

          try

          {

               loadTrait.unload();

          }

          catch (e:Error)

          {

               // you can probably simply ignore the error

          }

           

          Let me know if this helps.

           

           

          Thanks,

          Vijay

          • 2. Re: SWFElements & ImageElements not unloading on set element
            gregbown Level 1

            Hi Vijay,

             

            I am sorry that I was not clear. My work around was to do away with the serial composition and load the elements directly into the MediaPlayer

            with mediaPlayer.element = mediaArray[0];

             

            On video elements everything works properly however the second time an image element or SWF element is loaded you can see the original still on the display list.

             

            I will put together a more simple test code.

             

            Thank you for your time

            Greg

            • 3. Re: SWFElements & ImageElements not unloading on set element
              gregbown Level 1

              Hello again Vijay

               

              I put togethe a Flash CS4 test application that duplicates the image and swf element unload problem.

              You will need to substitute the media though and then update the corresponding const. Click the blank thumbnails to set corisponding _referenceArray position. I am not using serial element in this app though some of that code is in there comented out. This structure was intended to work around the inability to seek by loading video, image and swf elements directly through the MediaPlayerSprite.element = (type)Element method.

               

              Thank you

              • 4. Re: SWFElements & ImageElements not unloading on set element
                Edwin van Rijkom Level 2

                Hi Greg,

                 

                Vijay asked me to take a look, and I was able to reproduce the trouble you're reporting. I've filed a bug:

                http://bugs.adobe.com/jira/browse/FM-339

                 

                I'll let you know when we get it fixed!

                 

                Cheers,

                Edwin

                • 5. Re: SWFElements & ImageElements not unloading on set element
                  gregbown Level 1

                  Hi Vijay,

                   

                  I am not sure what exactly was changed but as of svn commit 13628 SWFElements and ImageElements are unloading properly.

                   

                  Thank you and the team very much!!! I now have a way forward in my application.

                   

                  Greg

                  • 6. Re: SWFElements & ImageElements not unloading on set element
                    Edwin van Rijkom Level 2

                    That's great to hear, Greg!

                     

                    Your report led to the fix of two problems with ParallelDisplayObject (rev. 13557,13558), as well one with LayoutRenderer (rev. 13564). The last one impacted your issue directly, because layout renderer would fail to unstage the display objects belonging to otherwise unloaded media elements.

                     

                    Thank you for reporting!

                     

                    Cheers,

                    Edwin

                    • 7. Re: SWFElements & ImageElements not unloading on set element
                      gregbown Level 1

                      Hi Edwin,

                       

                      I am not sure if this is a new bug related to this issue however when I set a VideoElement, after any other element, that was loaded prior the duration comes up NaN despite it having been loaded and played prior causing autoPlay to fail and thus it is not added to the stage.  It did not do this prior. There is a work around: calling play on the duration change event will trigger the display. Dont get me wrong, it is still better than before, I just wanted to let you know about the anomaly.

                       

                      Thanks again

                      Greg