resizing DataGrid using flash actionscript

Posted by Vineela | Flash, as3, utils | Saturday 31 January 2009 10:30 am

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

Posted by Vineela | Flash, as3, utils | Wednesday 28 January 2009 10:02 am

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

Posted by Vineela | Flash, as3, utils | Friday 26 December 2008 5:20 am
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

Posted by druva | Uncategorized | Wednesday 26 November 2008 1:47 pm

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;
}