|
Page 6 of 8 Creating Inputs, Lists, and LabelsAll this code really does is instantiate labels, inputs, and lists, which could actually be drawn on the stage with less code, but I have already written the code. //--------------------------- var textInput:TextInput = new TextInput(); textInput.move(10, 150); textInput.width = 220;
//Press the enter key to apply filter (search) textInput.addEventListener("enter",changeHandler); //Everytime the input box is changed, apply filter (search) //(can affect performance) textInput.addEventListener(Event.CHANGE, changeHandler);
textInput.tabIndex = 0; addChild(textInput);
var textInputLabel:Label = new Label(); textInputLabel.text = "Search grid"; textInputLabel.move(textInput.x + 5, textInput.y - 20); textInputLabel.autoSize = TextFieldAutoSize.LEFT; addChild(textInputLabel);
//--------------------------- var makeList:List = new List(); makeList.move(10,40); makeList.width = 100; makeList.rowCount = 4; makeList.addEventListener(Event.CHANGE, changeHandler); makeList.tabIndex = 1; addChild(makeList);
var makeLabel:Label = new Label(); makeLabel.htmlText = "Make"; makeLabel.move(makeList.x + 5, makeList.y - 20); makeLabel.autoSize = TextFieldAutoSize.LEFT; makeList.tabIndex = 2; addChild(makeLabel);
//--------------------------- var modelList:List = new List(); modelList.move(makeList.x + makeList.width + 10, 40); modelList.width = 125; modelList.rowCount = 4; modelList.addEventListener(Event.CHANGE, changeHandler); addChild(modelList);
var modelLabel:Label = new Label(); modelLabel.htmlText = "Model"; modelLabel.move(modelList.x + 5, modelList.y - 20); modelLabel.autoSize = TextFieldAutoSize.LEFT; addChild(modelLabel);
//--------------------------- var yearList:List = new List(); yearList.move(modelList.x + modelList.width + 10, 40); yearList.width = 65; yearList.rowCount = 4; yearList.addEventListener(Event.CHANGE, changeHandler); addChild(yearList);
var yearLabel:Label = new Label(); yearLabel.htmlText = "Year"; yearLabel.move(yearList.x + 5, yearList.y - 20); yearLabel.autoSize = TextFieldAutoSize.LEFT; addChild(yearLabel);
//--------------------------- var hpList:List = new List(); hpList.move(yearList.x + yearList.width + 10, 40); hpList.width = 85; hpList.rowCount = 3; hpList.addEventListener(Event.CHANGE, changeHandler); addChild(hpList);
var hpLabel:Label = new Label(); hpLabel.htmlText = "Horsepower"; hpLabel.move(hpList.x+5, hpList.y - 20); hpLabel.autoSize = TextFieldAutoSize.LEFT; addChild(hpLabel);
//--------------------------- var optionList:List = new List(); optionList.move(hpList.x + hpList.width + 10, 40); optionList.width = 135; optionList.rowCount = 4; optionList.addEventListener(Event.CHANGE, changeHandler); addChild(optionList);
var optionLabel:Label = new Label(); optionLabel.htmlText = "Options"; optionLabel.move(optionList.x + 5, optionList.y - 20); optionLabel.autoSize = TextFieldAutoSize.LEFT; addChild(optionLabel);
//---------------------------
|