0 Replies Latest reply on Sep 7, 2007 7:38 PM by notrem

    List Control

    notrem
      I want to fill a list control using Actionscript in Flex 2. I copied the code below. It's missing the MXML portion. I am new to Actionscript and Flex 2, and could you help finish this off.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal" verticalAlign="left" backgroundColor="white" creationComplete="init()">

      <mx:Script>
      <![CDATA[

      import fl.controls.List;

      var aList:List = new List();
      aList.addItem({label:"One", data:1});
      aList.addItem({label:"Two", data:2});
      aList.addItem({label:"Three", data:3});
      aList.addItem({label:"Four", data:4});
      aList.addItem({label:"Five", data:5});
      aList.setSize(60, 40);
      aList.move(200,200);
      addChild(aList);
      aList.addEventListener(Event.CHANGE, changeHandler);
      function changeHandler(event:Event):void {
      trace(event.target.selectedItem.data);
      }

      ]]

      </mx:Script>

      </mx:Application>

      Thanks,

      JL