Necesito ayuda, e estado desarrollando una aplicacion donde quiero cargar un modulo a mi aplicacion principal que está en AIR. El problema está que al apretar un boton no me carga nada, pero esta misma aplicación la hago correr en web y me cambia de modulos sin problemas, bueno quiero solucionar esto con ayuda de ustedes.
dejo el co´digo a continuacion. los modulos estan en blanco por que no hago niun codigo en ellos.
main.mxml
Código ActionScript :
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <mx:Button x="261" y="74" label="A" width="124" height="26" id="boton1" fontSize="12" click="click_boton(event)"/> <mx:Button x="413" y="74" label="B" width="124" height="26" id="boton2" fontSize="12" click="click_boton(event)"/> <mx:Button x="568" y="73" label="C" width="124" height="26" id="boton3" fontSize="12" click="click_boton(event)"/> <mx:ModuleLoader y="117" width="554" height="241" horizontalCenter="50" id="ModCarga" /> <fx:Script source="ModCarga.as"/> </s:WindowedApplication>
ModCarga.as
Código ActionScript :
import flash.events.MouseEvent; import mx.controls.Alert; import mx.events.CloseEvent; private var estado:String = "vacio"; private var Modx:String; private function Cargar(Obj:CloseEvent):void { if (Obj.detail==Alert.OK) { ModCarga.url = Modx; } } protected function click_boton(event:MouseEvent):void { var Clickear:String = String(event.target.name); var mod1:modulo1 = new modulo1(); var mod2:modulo2 = new modulo2(); var mod3:modulo3 = new modulo3(); if(Clickear == "boton1") { if(estado=="vacio") { ModCarga.url = "modulo1.swf"; estado="mod1"; } else if(ModCarga.url!="modulo1.swf") { Alert.show("Esta seguro que desea cambiar?","Cambiará de Módulo", Alert.OK | Alert.CANCEL,this,Cargar); Modx = "modulo1.swf"; estado = Modx; } } if(Clickear == "boton2") { if(estado=="vacio") { ModCarga.url = "modulo2.swf"; estado="mod2"; } else if(ModCarga.url!="modulo2.swf") { Alert.show("Esta seguro que desea cambiar?","Cambiará de Módulo", Alert.OK | Alert.CANCEL,this,Cargar); Modx = "modulo2.swf"; estado =Modx; } } if(Clickear == "boton3") { if(estado=="vacio") { ModCarga.url = "modulo3.swf"; estado="mod3"; } else if(ModCarga.url!="modulo3.swf") { Alert.show("Esta seguro que desea cambiar?","Cambiará de Módulo", Alert.OK | Alert.CANCEL,this,Cargar); Modx = "modulo3.swf"; estado = Modx; } } }
modulo1.mxml
Código ActionScript :
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="244" height="218"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> </mx:Module>
modulo2.mxml
Código ActionScript :
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="244" height="218"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> </mx:Module>
modulo3.mxml
Código ActionScript :
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="244" height="218"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> </mx:Module>
desde ya gracias