views:

19

answers:

2

I am embedding a swf built in flash 8 into an as3 project. When I call stop() or gotoAndStop(0); on the MovieClip that represents an instance of the embedded swf it stops for a sec and then continues. Trying to call removeChild on the mc removes it from the display but the audio in the swf keeps playing. The swf, in this case must be embedded, I cannot use loader. Any ideas

The code:

    [Embed (source = "t1.swf")]
    private var t1:Class;

    private var mc:MovieClip;

      public function iphoneTest()
      {
       var tf:TextField = new TextField();   
       tf.x = 10;
       tf.y = 100;
       tf.width = 100;
       tf.height = 50;
       tf.text = "Hello worl";
       mc = new t1();
       var button:CustomSimpleButton = new CustomSimpleButton();
       button.width = 50;
       button.height = 50;
       button.x = 10;
       button.y = 150;
       button.addEventListener(MouseEvent.CLICK, onClick);

       this.addChild(mc);
       this.addChild(tf);
       this.addChild(button);
   }

   private function onClick(e:MouseEvent):void {

       mc.stop();    
       this.removeChild(mc);
   }
A: 

did you try mc = null;?

also since you know it's an as2 swf, should probably use avm1movie instead of MovieClip

Daniel
A: 

At very worst you can just kill all sounds in the SWF...

Make sure you import the sound mixer class then kill the sound..

import flash.media.SoundMixer; 
SoundMixer.stopAll();
JMullaney