<! JSFL -loop through selection

Hi I am trying to be a build a copy and paste attributes extension for MX…

I can get it to work with only one item selected bbut am struggling to be able to loop through my selection… can any one help… At present I have the following…

sel = fl.getDocumentDOM().selection;
i = sel.length;
fl.trace("sel length = " + sel.length);
fl.trace("selection = " + sel)
while (i--) {
	fl.trace("element type = "+sel*.elementType);
	with (sel*) {
		if (sel*.elementType == "shape") {
			fl.getDocumentDOM().enterEditMode();
			fl.getDocumentDOM().selectAll();
		// other actions go here to paste attributes...
			fl.getDocumentDOM().exitEditMode();
		}
	}
}

I figure the problem might be with my “with” statement… any ideas???