Advertisement
Advertisement
| 02.14.2008 at 10:06AM PST, ID: 23163783 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: |
//This example demonstrates how data providers can be used to maintain the contents of several data grids.
//To run the example, follow these steps:
//1 Add the Label, Button, ComboBox, TextInput, and DataGrid components to the library.
//2 Save this code as DataProviderExample.as in the same directory as your FLA file.
//3 Set the Document class in the FLA file to DataProviderExample.
package
{
import fl.controls.Button;
import fl.controls.ComboBox;
import fl.controls.DataGrid;
import fl.controls.Label;
import fl.controls.TextInput;
import fl.data.DataProvider;
import flash.display.Sprite;
import flash.events.*;
import flash.text.TextFieldAutoSize;
public class DataProviderExample extends Sprite
{
private var southern:DataGrid;
private var northern:DataGrid;
private var world:DataGrid;
private var southernRoster:DataProvider;
private var northernRoster:DataProvider;
private var leagueCB:ComboBox;
private var nameTI:TextInput;
private var goalsTI:TextInput;
private var submitBtn:Button;
public function DataProviderExample() {
southernRoster = new DataProvider();
northernRoster = new DataProvider();
createDataGrids();
createUI();
}
private function createUI():void {
var description:Label = new Label();
description.text = "Enter player's name, goals scored, and hemisphere of origin:";
description.autoSize = TextFieldAutoSize.LEFT;
nameTI = new TextInput();
goalsTI = new TextInput();
var submitBtn:Button = new Button();
submitBtn.label = "Submit Player";
submitBtn.addEventListener(MouseEvent.CLICK, submitPlayer);
leagueCB = new ComboBox();
leagueCB.addItem( { label:"Northern", data: 0 } );
leagueCB.addItem( { label:"Southern", data: 1 } );
description.move(10,10);
nameTI.move(10,40);
nameTI.setSize(150,24);
goalsTI.move(170,40);
goalsTI.setSize(40,24);
leagueCB.move(220,40);
leagueCB.setSize(120,24);
submitBtn.move(350,40);
goalsTI.restrict = "0123456789";
addChild(description);
addChild(leagueCB);
addChild(submitBtn);
addChild(nameTI);
addChild(goalsTI);
}
private function submitPlayer(e:MouseEvent):void {
if(nameTI.text != "" && goalsTI.text != "") {
var targetRoster:DataProvider;
if(leagueCB.selectedItem.label == "Southern") {
targetRoster = southernRoster;
}
else {
targetRoster = northernRoster;
}
targetRoster.addItem( { Name: nameTI.text, Goals: goalsTI.text } );
var worldRoster:DataProvider = southernRoster.clone();
worldRoster.merge(northernRoster);
worldRoster.sortOn("Goals", Array.NUMERIC | Array.DESCENDING);
southernRoster.sortOn("Goals", Array.NUMERIC | Array.DESCENDING);
northernRoster.sortOn("Goals", Array.NUMERIC | Array.DESCENDING);
world.dataProvider = worldRoster;
nameTI.text = "";
goalsTI.text = "";
}
}
private function createDataGrids():void {
southern = new DataGrid();
northern = new DataGrid();
world = new DataGrid();
southern.move(10,100);
northern.move(180,100);
world.move(350,100);
southern.setSize(170, 250);
northern.setSize(170, 250);
world.setSize(170, 250);
southern.columns =
northern.columns =
world.columns = [ "Name", "Goals" ];
southern.dataProvider = southernRoster;
northern.dataProvider = northernRoster;
addChild(southern);
addChild(northern);
addChild(world);
var northernLabel:Label = new Label();
northernLabel.autoSize = TextFieldAutoSize.LEFT;
northernLabel.text = "Southern Hemisphere";
northernLabel.move(10,75);
addChild(northernLabel);
var southernLabel:Label = new Label();
southernLabel.autoSize = TextFieldAutoSize.LEFT;
southernLabel.text = "Northern Hemisphere";
southernLabel.move(180,75);
addChild(southernLabel);
var majorLabel:Label = new Label();
majorLabel.autoSize = TextFieldAutoSize.LEFT;
majorLabel.text = "World";
majorLabel.move(350,75);
addChild(majorLabel);
}
}
}
|