main.mxml:
Código Flex :
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
import com.controller.appControll;
public var controller:appControll = new appControll(appViews);
]]></mx:Script>
<mx:VBox width="990" paddingLeft="0" paddingRight="0" horizontalCenter="0" top="12">
   <mx:HBox>
      <mx:Button label="appView1" click="controller.load('appView1', appViews)" ></mx:Button>
      <mx:Button label="appView2" click="controller.load('appView2', appViews)" ></mx:Button>
   </mx:HBox>
        <mx:ViewStack id="appViews" width="100%" height="550" creationPolicy="all">
            
        </mx:ViewStack>
</mx:VBox>
</mx:WindowedApplication>
vista1.mxml:
Código Flex :
<?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" title="appView1" height="75%" width="75%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"> <mx:Label width="100%" color="blue" text="Hola mundo"/> </mx:Panel>
vista2.mxml:
Código Flex :
<?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" title="appView2" height="75%" width="75%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"> <mx:Label width="100%" color="blue" text="Hola mundo"/> </mx:Panel>
y aquí es donde necesito la ayuda:
appControll.as:
Código ActionScript :
package com.controller 
{
   public class appControll
   {
      public function appControll() 
      {
         
      }
      public function load(view:String, obj:Object):void {         
           switch (view) {
                     case "appView1":   
                     // cargar la vista1.mxml en obj (aquí es donde no se como hacerle para cargar ese mxml);
                     break ;
                     case "appView2":
                      // cargar la vista2.mxml en obj (y aquí tampoco se como hacerle para cargar ese mxml);
                      break ;
   
                     default:
      
                 }
            
            
      }   
   }
}
Bueno espero que me haya podido explicar, saludos y gracias.


 
  
			 
    
  
  
  
			