Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i click button , new data was created . i want to focus or selected that new item .
How can i do that .
Here my code

XML
<?xml version="1.0" encoding="utf-8"?>

<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">
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script>
        <![CDATA[
            // Add data item, and button, to the List.
            private function addFlexToDP():void {
                myBB.dataProvider.addItem("Flex");
                addFlex.enabled=false;

                // how to select or focus to new item created
            }

        ]]>
    </fx:Script>

    <s:List id="myBB">
        <mx:ArrayCollection>
            <fx:String>Flash</fx:String>
            <fx:String>Director</fx:String>
            <fx:String>Dreamweaver</fx:String>
            <fx:String>ColdFusion</fx:String>
        </mx:ArrayCollection>
    </s:List>

    <s:Button id="addFlex" label="Add Flex"
              click="addFlexToDP();"/>

</s:Application>
Posted
Updated 25-Aug-14 23:23pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900