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
 
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>



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Samuel Reuben
Sent: Tuesday, July 25, 2006 12:31 PM
To: [email protected]
Subject: Re: [flexcoders] SWFLoader related query / challenge

Do you want to interaction between the swf's? You most probably will run into problems here.
If you don't mind what are you trying to achive?
 
Thanks,
-sam

 
On 7/24/06, Vishwajit Girdhari <[EMAIL PROTECTED]> wrote:

 
One problem in flex... 
 
You have 3  .mxmls  that get compiled into   .swf  ( Say  A , B , C  . )
 
step1 You have to load B inside A
step2 In B there is a button on click you have to unload B from A and load C
step3 Also in C there is a button on click you have to unload C from A and load B 
 
---
 
My approach
 
for Step1 : cool!
     I am loading B in A using SWFLoader.
 
for step2 : stuck!
    I am not able get hold of the instance A  from which i can change source property of swfLoader (instance) to "C.swf"
 
for step : whatever works for step 2 :-(
 
 
--
 
your thoughts please.
 
thanks
vishwajit


__._,_.___

--
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




__,_._,___

Reply via email to