Skip navigation
cy3erbob
Currently Being Moderated

Load many file XML

Dec 11, 2012 2:05 PM

Tags: #flex #button #xml

Welcome.

I am working with flex from 2 weeks and I have one problem.

I have a panel that displays the images when the user hovers mouse on the thumbnail images in HorizontalList, at the bottom of the panel. Images in HorizontalList are taken from the XML file.

I did today, 3 buttons and I would like something like this - when I click on the button 1 - load XML No. 1 in HorizontalList. When I click on the button 2 - load XML No. 2 in HorizontalList etc..

 

<mx:XML id="xml" source="gallery.xml" />

    <mx:XMLListCollection id="xmlListColl" source="{xml.image}" />

    <mx:MenuBar fontFamily="Verdana" fontSize="11" fontStyle="normal" fontWeight="normal">

        <mx:Button label="button1" id="button1"/>

        <mx:Button label="button2" id="button2"/>

        <mx:Button label="button3" id="button3"/>

    </mx:MenuBar>

    <mx:Panel id="panel"

            layout="absolute"

            styleName="opaquePanel"

            width="100%"

            height="100%">

        <mx:Image id="img"

                scaleContent="true"

                horizontalCenter="0"

                verticalCenter="0"

                maintainAspectRatio="true"

                width="250"

                height="250"

                completeEffect="Fade" />

        <mx:ControlBar>

            <mx:HorizontalList id="horizontalList"

                    dataProvider="{xmlListColl}"

                    labelField="lbl"

                    iconField="src"

                    itemRenderer="CustomItemRenderer"

                    columnCount="4"

                    columnWidth="125"

                    rowHeight="100"

                    width="100%"

                    horizontalScrollPolicy="on"

                    change="horizontalList_change(event);"

                    itemRollOver="horizontalList_itemRollOver(event);"

                    itemRollOut="horizontalList_itemRollOut(event);"

                    doubleClickEnabled="true"

                    doubleClick="horizontalList_doubleClick(event);" />

        </mx:ControlBar>

    </mx:Panel>

 

</mx:Application>

 

Can anybody help me to do this, please?

 
Replies
  • Currently Being Moderated
    Dec 14, 2012 8:52 AM   in reply to cy3erbob

    Hi,

    When you click a button just update the image and the dataprovider of the list.

    <mx:Button label="button1" id="button1" click="updateData()" />

     

    private function updateDate():void{

         img.source = nameOfimage;

         xmlListColl = new list;

    }

     

    I hope that helps. Best,

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points