|
Hey Sam
,
Thanks for the
interest show in resolving my query.
Actually I wanted to
dynamically load / unload my 'sub applications' (compiled
swf)
but user feel should
be as if only one mxml has been loaded.
Two days after
making this post I figured out a simple way to achieve
this.
Code below
demonstrates the my approach.
Thanks,
Vishwajit
Girdhari
Flexblog :
http://flexiness.blogspot.com
Main.mxml
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init(event)" > <mx:Script> <![CDATA[ import mx.controls.Alert; import flash.events.Event; private function init(e:Event):void { //doing nothing } public function loadSWF (filename : String) : void { swfLoader.source=filename; } ]]> </mx:Script> <mx:SWFLoader id="swfLoader" source="one.swf" ></mx:SWFLoader> </mx:Application> one.mxml
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.controls.Alert; public function handleOne ( event : Event ) :void { mx.core.Application.application.loadSWF("two.swf"); } ]]> </mx:Script> <mx:Button id="btnOne" label="Button One" click="{handleOne(event)}" y="200"></mx:Button> </mx:Application> two.mxml
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import flash.profiler.showRedrawRegions; import mx.controls.Alert; public function handleTwo ( event : Event ) :void { mx.core.Application.application.loadSWF("one.swf"); } ]]> </mx:Script><mx:Button id="btnTwo" label="Button Two" click="handleTwo(event)" x="300"></mx:Button> </mx:Application> __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS
__,_._,___ |

