Comunidad de diseño web y desarrollo en internet online

flex comboboy y tileList

Citar            
MensajeEscrito el 07 Ago 2007 04:51 pm
:D estoy haciendo una aplicacion en la que tengo un un combo box. primeramente de mi dataProvider lleno el tilelist con todas las fotitos de mi dataProvider. ahora lo que necesito hacer y no se como es que cuando seleciono del combo box. en el change="{funcion}" me ponga solo la fotos en el tileList de la categoria que selecciono. por favor alguien que me pueda orientar en esto......

Por alexoboy

10 de clabLevel



 

msie7
Citar            
MensajeEscrito el 07 Ago 2007 06:19 pm
Supongo que la filterFunction de tu dataProvider. Haces que solo se vean las de la categoría que seleccionas, más o menos así:

Código :

function filtrar (item : Object) : Boolean {
  return item.categoria == tuCombo.selectedItem.categoria
}

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 07 Ago 2007 08:30 pm
:( no se como implementarlo.
mira te muestro donde uso el combo y el tileList:

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="900" height="550" title="Catálogo" 
   xmlns:v = "comps.*" backgroundColor="#8e95ba" dropShadowEnabled="true" borderColor="#ffffff" borderThickness="2" >
   <mx:Script>
      <![CDATA[
         import mx.collections.ArrayCollection;
         import mx.rpc.events.ResultEvent;
         [Bindable]
         public var photoData:ArrayCollection;
         [Bindable]
         public var selectedPhoto:Object;
         public function displayDetails(event:Event):void {
            currentState = 'details';
            selectedPhoto = new Object();
            selectedPhoto = event.currentTarget.selectedItem;
            photoInState.load('assets/img/'+selectedPhoto.imagen+'.png');         
         }
         [Bindable]
         public var listaData:ArrayCollection;
      ]]>
   </mx:Script>
   <mx:states>
      <mx:State name="details">
         <mx:RemoveChild target="{galeriatile}"/>
         <mx:AddChild position="lastChild" >
      <mx:Panel x="30" y="30" width="750" height="350" layout="absolute" title=" {selectedPhoto.descripcion}">
      <mx:Image    id="photoInState" width="300"
               x="19" y="10" 
         />
         <mx:Text text="Codigo:" fontSize="14" x="425" y="30" textAlign="right" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Medida:" fontSize="14" x="425" y="60" textAlign="right" fontFamily="Verdana" color="#676f9b"/>   
         <mx:Text text="Empaque Interior:" fontSize="14" x="351" y="90" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Empaque Caja:" fontSize="14" x="372" y="120" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Unidad Empaque:" fontSize="14" x="355" y="150" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Color:" fontSize="14" x="436" y="180" fontFamily="Verdana" color="#676f9b"/>
            
               <!--
               cajas de texto
               -->
            <mx:TextArea x="484" y="33" height="27"  text="{selectedPhoto.codigo}" id="codigo" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
            
            <mx:TextArea x="484" y="63" height="27"  text="{selectedPhoto.medida}" id="medida" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
            <mx:TextArea x="484" y="93" height="27"  text="{selectedPhoto.emp_int}" id="emp_int" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>

               
            <mx:TextArea x="484" y="123" height="27"  text="{selectedPhoto.emp_caja}" id="emp_caja" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
               <mx:TextArea x="484" y="152" height="27"  text="{selectedPhoto.uni_descripcion}" id="uni_emp" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:TextArea x="484" y="183" height="27"  text="{selectedPhoto.color}" id="colores" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:Button
               x="580" y="278"
               fillAlphas="[1,.8]"
               fillColors="[#ffffff, #F8E5BB]"
               label="Regresar a catálogo" click="currentState=''" />
   </mx:Panel>
         </mx:AddChild>
      </mx:State>
   </mx:states>
   <mx:HBox width="759" verticalAlign="middle" y="2" horizontalAlign="right" x="90" height="22">
      <mx:Label text="Seleccione" color="#ffffff"/>
      <mx:CheckBox label="Todas las imagenes" color="#ffffff"/>
      <mx:Label text="Por categoría" color="#ffffff"/>
      <mx:ComboBox id="tipo" dataProvider="{listaData}" labelField="tip_nombre" ></mx:ComboBox>
      
    </mx:HBox>
       
    <mx:TileList id="galeriatile" dataProvider="{photoData}" change="displayDetails(event)"   
       columnWidth="170" rowHeight="170" width="755" rollOverColor="#8e95ba" borderThickness="2"  
       itemRenderer="comps.DisplayImage"  
        height="380" verticalCenter="-10" backgroundAlpha="1"  maxColumns="4" x="16" cornerRadius="0" 
        selectionColor="#5c6179" verticalAlign="middle" dropShadowEnabled="true" borderColor="#555b7c"/>
        
    <mx:Text x="779" y="285" text="{tipo.selectedItem.tip_cve}" width="47" id="ddd"/>
    
       

</mx:Panel>

se que esta hiper largo........ pero si le puedes hechar un ojito te lo agradecere.......

Por alexoboy

10 de clabLevel



 

msie7
Citar            
MensajeEscrito el 07 Ago 2007 09:03 pm
Pues... puedes definir photoData con mxml o puedes definir en una función initialize () y allí le pones propiedad filterFunction a algo como lo de arriba.

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 07 Ago 2007 09:14 pm
tienes algun ejemplo para esto?????

Por alexoboy

10 de clabLevel



 

msie7
Citar            
MensajeEscrito el 07 Ago 2007 09:30 pm

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="900" height="550" title="Catálogo" 
   xmlns:v = "comps.*" backgroundColor="#8e95ba" dropShadowEnabled="true" borderColor="#ffffff" borderThickness="2" >
   <mx:Script>
      <![CDATA[
         import mx.collections.ArrayCollection;
         import mx.rpc.events.ResultEvent;
         [Bindable]
         public var selectedPhoto:Object;
         private function filtrar (item : Object) : Boolean {
                  return item.categoria == tipo.selectedItem.categoria
           }
         public function displayDetails(event:Event):void {
            currentState = 'details';
            selectedPhoto = new Object();
            selectedPhoto = event.currentTarget.selectedItem;
            photoInState.load('assets/img/'+selectedPhoto.imagen+'.png');         
         }
         [Bindable]
         public var listaData:ArrayCollection;
      ]]>
   </mx:Script>
   <mx:Metadata>
    [Bindable]
</mx:Metadata>
   <mx:ArrayCollection id="photoData" filterFunction="filtrar"/>
   <mx:states>
      <mx:State name="details">
         <mx:RemoveChild target="{galeriatile}"/>
         <mx:AddChild position="lastChild" >
      <mx:Panel x="30" y="30" width="750" height="350" layout="absolute" title=" {selectedPhoto.descripcion}">
      <mx:Image    id="photoInState" width="300"
               x="19" y="10" 
         />
         <mx:Text text="Codigo:" fontSize="14" x="425" y="30" textAlign="right" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Medida:" fontSize="14" x="425" y="60" textAlign="right" fontFamily="Verdana" color="#676f9b"/>   
         <mx:Text text="Empaque Interior:" fontSize="14" x="351" y="90" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Empaque Caja:" fontSize="14" x="372" y="120" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Unidad Empaque:" fontSize="14" x="355" y="150" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Color:" fontSize="14" x="436" y="180" fontFamily="Verdana" color="#676f9b"/>
            
               <!--
               cajas de texto
               -->
            <mx:TextArea x="484" y="33" height="27"  text="{selectedPhoto.codigo}" id="codigo" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
            
            <mx:TextArea x="484" y="63" height="27"  text="{selectedPhoto.medida}" id="medida" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
            <mx:TextArea x="484" y="93" height="27"  text="{selectedPhoto.emp_int}" id="emp_int" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>

               
            <mx:TextArea x="484" y="123" height="27"  text="{selectedPhoto.emp_caja}" id="emp_caja" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
               <mx:TextArea x="484" y="152" height="27"  text="{selectedPhoto.uni_descripcion}" id="uni_emp" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:TextArea x="484" y="183" height="27"  text="{selectedPhoto.color}" id="colores" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:Button
               x="580" y="278"
               fillAlphas="[1,.8]"
               fillColors="[#ffffff, #F8E5BB]"
               label="Regresar a catálogo" click="currentState=''" />
   </mx:Panel>
         </mx:AddChild>
      </mx:State>
   </mx:states>
   <mx:HBox width="759" verticalAlign="middle" y="2" horizontalAlign="right" x="90" height="22">
      <mx:Label text="Seleccione" color="#ffffff"/>
      <mx:CheckBox label="Todas las imagenes" color="#ffffff"/>
      <mx:Label text="Por categoría" color="#ffffff"/>
      <mx:ComboBox id="tipo" dataProvider="{listaData}" labelField="tip_nombre" ></mx:ComboBox>
      
    </mx:HBox>
       
    <mx:TileList id="galeriatile" dataProvider="{photoData}" change="displayDetails(event)"   
       columnWidth="170" rowHeight="170" width="755" rollOverColor="#8e95ba" borderThickness="2"  
       itemRenderer="comps.DisplayImage"  
        height="380" verticalCenter="-10" backgroundAlpha="1"  maxColumns="4" x="16" cornerRadius="0" 
        selectionColor="#5c6179" verticalAlign="middle" dropShadowEnabled="true" borderColor="#555b7c"/>
        
    <mx:Text x="779" y="285" text="{tipo.selectedItem.tip_cve}" width="47" id="ddd"/>
    
       

</mx:Panel>

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 07 Ago 2007 09:53 pm
lo trate de usar y papas no jalo........ quizas es por que no lo estoy passando en el change="" del combobox......
ademas no entiendo el porque que usaste los </mx:Metadata> en vez de ponerlos en el mx:script....sabes donde habra un ejemplo de un combobox que altere un tileList sin usar un dataProvider de CF........
perdon pero es que soy muy newbee.....en Flexo.-......

Por alexoboy

10 de clabLevel



 

msie7
Citar            
MensajeEscrito el 07 Ago 2007 10:05 pm
:D muchas gracias asi quedo el codigo y funciona muy bien....

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="900" height="550" title="Catálogo" 
   xmlns:v = "comps.*" backgroundColor="#8e95ba" dropShadowEnabled="true" borderColor="#ffffff" borderThickness="2" >
   <mx:Script>
      <![CDATA[
         import mx.collections.ArrayCollection;
         import mx.rpc.events.ResultEvent;
         [Bindable]
         public var photoData:ArrayCollection;
         [Bindable]
         public var selectedPhoto:Object;
         public function displayDetails(event:Event):void {
            currentState = 'details';
            selectedPhoto = new Object();
            selectedPhoto = event.currentTarget.selectedItem;
            photoInState.load('assets/img/'+selectedPhoto.imagen+'.png');         
         }
         [Bindable]
         public var listaData:ArrayCollection;
         public function selecTipo():void{
            tipo.selectedItem.tip_cve 
         }
         private function filtrar():void{
               photoData.filterFunction = selecc;
               photoData.refresh();
           }

         public function selecc(item:Object):Boolean{
            return item.tip_cve==tipo.selectedItem.tip_cve
         }
         
      ]]>
   </mx:Script>

   <mx:states>
      <mx:State name="details">
         <mx:RemoveChild target="{galeriatile}"/>
         <mx:AddChild position="lastChild" >
      <mx:Panel x="30" y="30" width="750" height="350" layout="absolute" title=" {selectedPhoto.descripcion}">
      <mx:Image    id="photoInState" width="300"
               x="19" y="10" 
         />
         <mx:Text text="Codigo:" fontSize="14" x="425" y="30" textAlign="right" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Medida:" fontSize="14" x="425" y="60" textAlign="right" fontFamily="Verdana" color="#676f9b"/>   
         <mx:Text text="Empaque Interior:" fontSize="14" x="351" y="90" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Empaque Caja:" fontSize="14" x="372" y="120" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Unidad Empaque:" fontSize="14" x="355" y="150" fontFamily="Verdana" color="#676f9b"/>
         <mx:Text text="Color:" fontSize="14" x="436" y="180" fontFamily="Verdana" color="#676f9b"/>
            
               <!--
               cajas de texto
               -->
            <mx:TextArea x="484" y="33" height="27"  text="{selectedPhoto.codigo}" id="codigo" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
            
            <mx:TextArea x="484" y="63" height="27"  text="{selectedPhoto.medida}" id="medida" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
            <mx:TextArea x="484" y="93" height="27"  text="{selectedPhoto.emp_int}" id="emp_int" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>

               
            <mx:TextArea x="484" y="123" height="27"  text="{selectedPhoto.emp_caja}" id="emp_caja" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
               <mx:TextArea x="484" y="152" height="27"  text="{selectedPhoto.uni_descripcion}" id="uni_emp" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:TextArea x="484" y="183" height="27"  text="{selectedPhoto.color}" id="colores" width="204" editable="false" 
      borderColor="#666666" borderThickness="2" borderStyle="outset" enabled="false" disabledColor="#000000"/>
               
      <mx:Button
               x="580" y="278"
               fillAlphas="[1,.8]"
               fillColors="[#ffffff, #F8E5BB]"
               label="Regresar a catálogo" click="currentState=''" />
   </mx:Panel>
         </mx:AddChild>
      </mx:State>
   </mx:states>
   <mx:HBox width="759" verticalAlign="middle" y="2" horizontalAlign="right" x="90" height="22">
      <mx:Label text="Seleccione" color="#ffffff"/>
      <mx:CheckBox label="Todas las imagenes" color="#ffffff"/>
      <mx:Label text="Por categoría" color="#ffffff"/>
      <mx:ComboBox id="tipo" dataProvider="{listaData}" labelField="tip_nombre" change="{filtrar()}"></mx:ComboBox>
      
    </mx:HBox>
       
    <mx:TileList id="galeriatile" dataProvider="{photoData}" change="displayDetails(event)"   
       columnWidth="170" rowHeight="170" width="755" rollOverColor="#8e95ba" borderThickness="2"  
       itemRenderer="comps.DisplayImage"  
        height="380" verticalCenter="-10" backgroundAlpha="1"  maxColumns="4" x="16" cornerRadius="0" 
        selectionColor="#5c6179" verticalAlign="middle" dropShadowEnabled="true" borderColor="#555b7c"/>
        
    <mx:Text x="779" y="285" text="{tipo.selectedItem.tip_cve}" width="47" id="ddd"/>
    
       

</mx:Panel>

:cool: uffff......... estubo peligiento.........

Por alexoboy

10 de clabLevel



 

msie7
Citar            
MensajeEscrito el 07 Ago 2007 11:35 pm
Solo me falto agradecer a Zah........ gracias de nuevo mil..

Por alexoboy

10 de clabLevel



 

msie7

 

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