3 Replies Latest reply on May 2, 2007 1:49 AM by James Bower

    pause a video (phone.flv) when changing component views

    James Bower
      I'm trying to pause a video (phone.flv) when changing component views via the main menu bar. A working example of what I am talking about can be found in the Flex store demo; if you start the short phone demo video (ProductSupport.mxml) and then leave that component for the HomeView component the video continues playing. However, if the video is on the main application component (flexstore.mxml), for example, where the ViewStack and ToggleButtonBar navigation exist then it's possible to pause the video by using:

      import mx.events.ItemClickEvent;

      private function clickHandler(event:ItemClickEvent):void {
      list.visible = true;

      What I'd like to be able to do is to get the video to pause when I switch from the ProductsView (ProductSupport.mxml) component (where the video is nested) to the HomeView component. Any ideas on how this can be done?

        • 1. Re: How about a reply Peter?
          peterent Level 2
          Sorry, I'm not a video person. I'd have to do some research on this and can look into when I have time. Since this isn't something I know off the top of my head, I suggest you open a formal support request with us. Otherwise I'll put it on my to-do this but I don't know when I'll get to it.
          • 2. pause a video (phone.flv) when changing component views
            VarioPegged Level 2
            I am assuming that by pause you mean for the video to quit playing when you're changing tabs (the default flexstore "support" video behavior is to keep playing even when the view has changed-not very user friendly). Or do you mean to pause in the literal sense so that you can come back to the same spot in the video after you've selected a different tab?

            If it is the former, specify a FocusEvent within the ProductSupport.mxml component, so that when it loses focus as you select a different tab, it simply calls a handler to stop the video. I haven't looked at the Flex store code in detail, so your mileage may vary:

            <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml"

            paddingLeft="4" paddingRight="8" paddingBottom="4"

            horizontalScrollPolicy="off" verticalScrollPolicy="off" creationComplete="addFocusListener();">



            import flash.events.FocusEvent;
            private function addFocusListener():void

            private function stopVideo(event:FocusEvent):void
            if (vd.playing) {
            list.visible = true;

            ... rest of code of ProductSupport.mxml
            • 3. Re: pause a video (phone.flv) when changing component views
              James Bower Level 1
              Thank you VarioPegged. That was exactly the solution I was looking for!