Comunidad de diseño web y desarrollo en internet online

Enlacar botones a ficheros MXML

Citar            
MensajeEscrito el 11 May 2009 02:02 pm
Hola,

Hace poco que he empezado a trabajar con flex y me ha saltado la siguiente duda:

Tengo un proyecto flex formad por tres aplicacionesmxml (principal.mxml, uno.mxml y dos.mxml) en la aplicacion principal.mxml he insertado el componente <mx:ApplicationControlBar/> y dentro de él dos botones. Mi idea es que cuando se pulse en el primer botón se muestre en contenido del fichero uno.mxml y cuando se pulse en el segundo voton se muestre el fichero dos.mxml. ¿Esto sepuede hacer? ¿Como?

Por josep1244

0 de clabLevel



 

msie8
Citar            
MensajeEscrito el 11 May 2009 06:29 pm
Puedes usar un ViewStack, no uses tres Applications, usa un Application y dos componentes personalizados

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 11 May 2009 09:49 pm
tal como lo dijo Solisarg, usas un viewStack

Código :

?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"
    horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" viewSourceURL="srcview/index.html">
    
    <mx:Panel title="ViewStack Container" layout="vertical" color="0xffffff" borderAlpha="0.15" height="240" width="500"
         paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">
         
         <mx:Text width="100%" color="0x323232" textAlign="center"
            text="Use the Button controls to change panels of the ViewStack container."/>

        <mx:HBox borderStyle="solid" width="100%" color="0x323232" horizontalAlign="center"
            paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5">
            
            <mx:Button id="searchButton" label="Search Panel"
                click="myViewStack.selectedChild=search;"/>
            <mx:Button id="cInfoButton" label="Customer Info Panel"
                click="myViewStack.selectedChild=custInfo;"/>
            <mx:Button id="aInfoButton" label="Account Panel"
                click="myViewStack.selectedChild=accountInfo;"/>
        </mx:HBox>

        <!-- Define the ViewStack and the three child containers and have it
        resize up to the size of the container for the buttons. -->
        <mx:ViewStack id="myViewStack" borderStyle="solid" width="100%" height="80%" color="0x323232">
        
            <mx:VBox id="search" label="Search" backgroundColor="0xDCDCDC" width="100%" height="100%" fontWeight="bold" >
                <mx:Label text="Search Panel" width="100%" textAlign="center" paddingTop="10" />
                <mx:HBox width="100%" horizontalAlign="center" >
                    <mx:TextInput id="Searchtxt" width="200" />
                    <mx:Button label="search" click="Searchtxt.text=''" />
                </mx:HBox>
            </mx:VBox>
            
            <mx:VBox id="custInfo" label="Customer Info" backgroundColor="0xDCDCDC" width="100%" height="100%" fontWeight="bold" horizontalAlign="center" >
                <mx:Label text="Customer Info" width="100%" textAlign="center" paddingTop="10" />
                <mx:HBox width="100%" horizontalAlign="center">
                
                    <mx:Label text="Email Address"/>
                    <mx:TextInput id="email" width="200"/>
                    <mx:Button label="Submit" click="email.text='';" />
                </mx:HBox>
                
            </mx:VBox>


Luego, en este caso es vbox el cual el view esta guardando(pero puedes guardar cualesquier cosa, podrás separar en carpetas, tus vistas y llamarlas así tendrás un código mas ordenado, o podrás también utilizar el carmagion o el pureMvc ya así tener aun mas tu código ordenado lo que corresponde a modelos vista controlador en fin puedes manejar como tu desees .buena suerte.

Por xcom

Claber

530 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.