Solved

List control to change dataprovider on a TileList

Posted on 2009-04-15
4
463 Views
Last Modified: 2012-05-06
I have a list control populated via xml and when you click one of the items in the list, I'd like to change the dataprovider on a tilelist based on that selection.  The dataproviders for the tilelist would be xmllistcollections.  So I guess I'd have several XMLListCollections and then the dataProvider for the tileList would need to be dynamic?  And could the dataProvider somehow be defined in the xml for the list control?
0
Comment
Question by:moglie
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24150149
There are a few ways you could do this.

I would have a function that gets a new XMLListCollection based on a url. Then reference that xml address in the xml file that builds your main TileList.

Then in the main TileList capture the click event and point it to the function that gets a new XMlListCollection. Once the XMlListColleciton is loaded, point the dataProvider for your 'sub'TileList in the direction of your newXMLListCollection.
0
 

Author Comment

by:moglie
ID: 24150559
This is what I have so far.  Of course it's not fully working.

                  private function changeHandler(evt:Event):void {                        
                         categoryTile.dataProvider = evt.currentTarget.selectedItem.provider;
                   }  

and then a few xmllistcollections:

      <mx:XML id="xml1" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListCol1l" source="{xml.image}"/>  

       <mx:XML id="xml2" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListColl2" source="{xml.image}"/>

       <mx:XML id="xml3" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListColl3" source="{xml.image}"/>

and then the xml:

<root>
      <categories>
            <name>Adjusting to War Memroies</name>
            <provider>xmlListColl1</provider>
      </categories>
      <categories>
            <name>Dealing With Depression</name>
            <provider>xmlListColl2</provider>
      </categories>
      <categories>
            <name>Handling Stress</name>
            <provider>xmlListColl3</provider>
      </categories>
</root>
0
 

Author Comment

by:moglie
ID: 24153479
Just for testing, if I directly assign a specific dataProvider in the function, it will obviously populate the tilelist with that data.  But can I use the provider node in the list control xml to essentially assign an xmllistcollection dp?

                  private function changeHandler(evt:Event):void {
                        categoryTile.dataProvider = xmlListColl;

                   }      

This just isn't working
 
categoryTile.dataProvider = evt.currentTarget.selectedItem.provider;

Open in new window

0
 
LVL 12

Accepted Solution

by:
lexxwern earned 500 total points
ID: 24154460
Try this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
	
	<mx:List id="list" width="30%" height="100%" labelField="@label">
		<mx:dataProvider>
			<mx:XMLListCollection>
				<mx:source>
					<mx:XMLList xmlns="">
						<node label="1">
							<node label="1.1"/>
							<node label="1.2"/>
							<node label="1.3"/>
						</node>
						<node label="2">
							<node label="2.1"/>
							<node label="2.2"/>
							<node label="2.3"/>
						</node>
						<node label="3">
							<node label="3.1"/>
							<node label="3.2"/>
							<node label="3.3"/>							
						</node>
					</mx:XMLList>
				</mx:source>
			</mx:XMLListCollection>
		</mx:dataProvider>
	</mx:List>
	
	<mx:TileList id="tileList" width="70%" height="100%" dataProvider="{XMLList(XML(list.selectedItem).node)}" 
            maxColumns="2" rowHeight="225" columnWidth="125" labelField="@label">
		
	</mx:TileList>
	
</mx:Application>

Open in new window

0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flex organization chart 5 615
Reloading a complete air application 13 448
Clickable link on fields from mysql 7 341
Actionscript 3 333
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question