SWF unload
hi friends
here my flex code....
[Embed(source="1.swf")]
private var _src_a:Class;
[Embed(source="2.swf")]
private var _src_b:Class;
import mx.controls.SWFLoader;
private var f:SWFLoader;
protected function checkBtn_clickHandler(event:MouseEvent):void
{
clear();
f = new SWFLoader();
f.load(_src_a);
_swf.addChild(f);
}
protected function critcalBtn_clickHandler(event:MouseEvent):void
{
clear();
f = new SWFLoader();
f.load(_src_b);
_swf.addChild(f);
}
protected function clear():void
{
//f.unloadAndStop();
//f.source="";
//f.load(null);
_swf.removeAllChildren();
flash.media.SoundMixer.stopAll();
}
<mx:Button id="checkBtn" label="first" click="checkBtn_clickHandler(event)"/>
<mx:Button id="critcalBtn" label="second" click="critcalBtn_clickHandler(event)"/>
<mx:Canvas id="_swf">
</mx:Canvas>
i have 2 swf which i embed in flex code now i chnage my swf from button click my problem is that i Forces the SWFloader to try to unload swf when other swf load, At this point sound from the first loaded SWF is still playing.
help me!!
Last edited by umesh8965; 10-07-2011 at 11:30 AM.
|