Skip navigation
Currently Being Moderated

Problems Stopping Video

Jun 29, 2012 11:51 AM

Hi,

 

I am using a TabbedViewNavigatorApplication, and when switching tabs I need video to stop playing. I've looked at the spark video player source code and adapted a function from it that assigns event listeners to all the parents. This code works fine on the current view, but if I switch tabs or go back a view, it does not work... the FlexEvent.Hide listeners don't fire. In the debugger I have verified that the below code does indeed assign the listeners all the way up the parent chain, so I am wondering if either the views are not getting destroyed or I am not using the right listeners. Does anyone know?

 

thx

 

/**

                     *  @private

                     *  Add event listeners for SHOW and HIDE on all the ancestors up the parent chain.

                     *  Adding weak event listeners just to be safe.

                     */

                    private function addVisibilityListeners():void

                    {

                              var current:IVisualElement = this;

 

                              while (current)

                              {

  // add visibility listeners to the parent

                                        current.addEventListener(FlexEvent.HIDE, visibilityChangedHandler, false, 0, true);

                                        current.addEventListener(FlexEvent.SHOW, visibilityChangedHandler, false, 0, true);

 

  // add listeners to the design layer too

                                        if (current.designLayer)

                                        {

                                                  current.designLayer.addEventListener("layerPropertyChange", designLayer_layerPropertyChangeHandler, false, 0, true);

                                        }

 

                                        current = current.parent as IVisualElement;

                              }

                    }

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points