Hi,

I've got some serious trouble using a TileList with Data-Binding. I 
have a TileList to display a part of an XML and a selectbox to switch 
betwenn different parts of this xml (chapters). The XMLListCollection 
containing the content of the TileList is Bindable and even changes, 
as you can see in the Debug-Textarea on the right side. But the 
TileList even does not notice about changing it's (bindable) 
dataprovider, all kinds of methods like invalidateData() or something 
does not take any effect.

Does anybody has an idea, what the problem is?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
        xmlns:mx="http://www.adobe.com/2006/mxml"; 
        initialize="init()"
        layout="absolute">
        <mx:Script>
                <![CDATA[
                        import mx.collections.XMLListCollection;
                        
                        [Bindable]
                        private var pages:XMLListCollection;
                        
                        [Bindable]
                        private var chapters:XMLListCollection;
                        
                        private function init():void
                        {
                                chapters = new XMLListCollection
(catalogueXML..chapter.chaptertitle);
                                trace('chapters: ' + 
chapters.toXMLString());
                                pages = new XMLListCollection
(catalogueXML.chapter[0]..page);
                                pageTileList.dataProvider = pages;
                                
                        }
                        
                        private function switchChapters
(event:Event):void
                        {
                                pages = new XMLListCollection
(catalogueXML.chapter[event.target.selectedIndex]..page);
                                pageTileList.initialize();
                        }
                        
                ]]>
        </mx:Script>
        <mx:ComboBox dataProvider="{chapters}" 
labelField="chaptertitle" change="switchChapters(event)" left="470" 
top="10"/>
        <mx:TileList id="pageTileList" width="450" left="10" top="10" 
bottom="10" itemRenderer="TestTileListItemRenderer"></mx:TileList>
        <mx:TextArea id="output" text="{pages.toXMLString()}" 
left="470" right="10" bottom="10" top="40">
                
        </mx:TextArea>
        
        <mx:XML id="catalogueXML">
                <catalogue>
                        <chapter>
                                <chaptertitle>
                                        chapter 1
                                </chaptertitle>
                                <page>
                                        <pagetitle>
                                                This is a test
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                This is not a test
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                Sd this is a test
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                This is for testing
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                Oh no, even a test 
too...
                                        </pagetitle>
                                </page>
                        </chapter>
                        <chapter>
                                <chaptertitle>
                                        chapter 2
                                </chaptertitle>
                                <page>
                                        <pagetitle>
                                                This is a test on 
page 2
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                This is not a test on 
page 2
                                        </pagetitle>
                                </page>
                                <page>
                                        <pagetitle>
                                                Oh no, even a test on 
page 2 too...
                                        </pagetitle>
                                </page>
                        </chapter>
                </catalogue>
        </mx:XML>
</mx:Application>

the ItemRenderer:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel 
        xmlns:mx="http://www.adobe.com/2006/mxml"; 
        layout="absolute" width="220" height="180"
        borderStyle="outset" borderColor="black" borderThickness="1"
        creationComplete="init()">
        <mx:Script>
                <![CDATA[
                        [Bindable]
                        private var pageTitle:String;
                        
                        private function init():void
                        {
                                pageTitle = 
this.data.pagetitle.toString();
                                this.title = pageTitle;
                        }
                ]]>
        </mx:Script>
        
</mx:Panel>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to