4 Replies Latest reply on Aug 3, 2009 11:01 AM by Gregory Lafrance

    Stopping a swf when canvas is hidden

    cbandes

      Hi - I have a really really simple little viewstack that is giving me trouble.

       

      The idea is that a different swf will be loaded into each canvas of the viewstack, and will be active when the view is active, and unloaded when the view gets hidden. Currently the swfs load as expected, but audio continues to play even after the view is hidden.

       

        • 1. Re: Stopping a swf when canvas is hidden
          Gregory Lafrance Level 6

          In each ViewStack view Canvas, unload the SWF on the "hide" event.

          1 person found this helpful
          • 2. Re: Stopping a swf when canvas is hidden
            cbandes Level 1

            Hi Greg - how do I unload it?

             

            (I'm not sure my pasted-in code is showing)

             

            I am doing this: hideEffect = decisionLoader.unloadAndStop();

             

            Where decisionLoader is the ID of the SWFLoader object present in that view.

             

            Code follows below:

             

            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                <mx:ViewStack x="137" y="10" id="decision" width="711.8182" height="623.48486">
                    <mx:Canvas label="Decision Table" width="100%" height="100%" hideEffect="decisionLoader.unloadAndStop();this.unloadAndStop();">
                        <mx:Panel x="0" y="0" width="704" height="609" layout="absolute" title="Decision Table" cornerRadius="20">
                            <mx:SWFLoader x="0" y="0" source="../ethics/Slides/Decisiontable.swf" scaleContent="true" autoLoad="true" id="decisionLoader"/>
                        </mx:Panel>
                    </mx:Canvas>
                    <mx:Canvas label="Evaluation Table" width="100%" height="100%"  hideEffect="evaluationLoader.unloadAndStop();this.unloadAndStop();">
                        <mx:Panel x="0" y="0" width="704" height="609" layout="absolute" cornerRadius="20" title="Evaluation Table">
                            <mx:SWFLoader x="0" y="0" source="../ethics/Slides/EvaluationTable_2.swf" scaleContent="true" autoLoad="true" id="evaluationLoader"/>
                        </mx:Panel>
                    </mx:Canvas>
                </mx:ViewStack>
                <mx:Image x="10" y="10" source="../images/icon1_IDissues.png" width="127" height="135"/>
                <mx:LinkBar direction="vertical" x="10" y="153" width="119" height="149" dataProvider="decision">
                </mx:LinkBar>
            </mx:Application>

            • 3. Re: Stopping a swf when canvas is hidden
              Gregory Lafrance Level 6

              Not hideEffect, hide event.

               

              <mx:Canvas hide="decisionLoader.unloadAndStop();">

                  ...

              </mx:Canvas>