0

I have XML file

<contact>
<title>Flex</title>
<title>Flash</title>
<title>Illustrator</title>
<title>Photoshop</title>
<title>Dreamweawer</title>
<title>Flash player</title>

in my application is tilelist which loads data from XML why I can not take the name of the selected item in the TextInput?

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="contactsService.send()">
<fx:Declarations>
<mx:HTTPService id="contactsService"
                resultFormat="e4x"
                url="contacts.xml"/>
</fx:Declarations>


<fx:Script>
    <![CDATA[
        import mx.events.ItemClickEvent;
        import mx.events.ListEvent;

        public function SomthingSelected ():void {
            txt.text = this.tileList.selectedItem.@title;   
        }

    ]]>
</fx:Script>
<mx:TileList id="tileList"
             dataProvider="{contactsService.lastResult.title}"
             columnCount="4"
             columnWidth="125"
             rowCount="2"
             rowHeight="100"
             verticalScrollPolicy="on" 
             itemClick="SomthingSelected ()"/>

<s:TextInput x="10" y="223" id="txt" text="Sergii hi"/>

Help me please (

1
  • 1
    Is your contact tag closed? Also the '@' notation is for attributes, not node values. Commented Apr 12, 2011 at 14:35

1 Answer 1

2

You don't need to specify the tag as the data is already there. Try doing this:

private function SomthingSelected ():void {
            txt.text = this.tileList.selectedItem.toString();   
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.