resizing DataGrid using flash actionscript


import fl.controls.DataGrid; 

var dg:DataGrid = new DataGrid();
dg.addColumn("Column1");
dg.addColumn("Column2");
dg.addItem({Column1:"Row 1 Col 1", Column2:"Row 1 Col 2"});
dg.addItem({Column1:"Row 2 Col 1", Column2:"Row 2 Col 2"});

dg.width = 100;
dg.setSize(100,20);
dg.rowCount = dg.length;
dg.move(10, 10);
addChild(dg);

create DataGrid instance using flash actionscript


import fl.controls.DataGrid; 

var dg:DataGrid = new DataGrid();
dg.addColumn("Column1");
dg.addColumn("Column2");
dg.addItem({Column1:"Row 1 Col 1", Column2:"Row 1 Col 2"});
dg.addItem({Column1:"Row 2 Col 1", Column2:"Row 2 Col 2"});
dg.width = 300;
dg.rowCount = dg.length;
dg.move(10, 10);
addChild(dg);

to restrict the number of characters in TextInput using flash actionscript

import fl.controls.TextInput;

var tI:TextInput = new TextInput();
tI.maxChars = 10;
tI.width = 200;
tI.move(10, 10);
addChild(tI);

flash set Max Height and Max Width

set Max Height and Max Width

function setMaxSizes(obj:*, maxWidth:Number, maxHeight:Number):void {
	if (obj.height > obj.width) {
		obj.width = (maxHeight * obj.width) / obj.height;
		obj.height = maxHeight;
	} else if (obj.width>obj.height) {
		obj.height = (maxWidth * obj.height) / obj.width;
		obj.width = maxWidth;
	} else {
		obj.width = maxWidth;
		obj.height = maxHeight;
	}
	return;
}