# Formatting text function not working

**URL:** <https://forum.kirupa.com/t/formatting-text-function-not-working/239073>\
**Category:** flash\
**Created:** [September 18, 2007, 3:14pm UTC](https://forum.kirupa.com/t/formatting-text-function-not-working/239073 "2007-09-18T15:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sixfngers](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@sixfngers](https://forum.kirupa.com/u/sixfngers)\
**Post date:** [September 18, 2007, 3:14pm UTC](https://forum.kirupa.com/t/formatting-text-function-not-working/239073/1 "2007-09-18T15:14:07Z")

</div>

Nevermind got it working.

moderators you can delete this thread

in AS 2 I used to be able to do this

```auto

private function makeNewFormat(passedKeys:Array, passedValues:Array, formatForField:TextField){
	var formatName:TextFormat = new TextFormat();
	var i:Number
	var limit:Number = passedKeys.length
			
	for(i=0; i<limit; i++){
		formatName[passedKeys*]= passedValues*;
	}
			
	formatForField.setTextFormat(formatName);
}

makeNewFormat([font, color, size, underline], ["Verdana", 0xFF0000, 10, true], _tf)

```

now when i do it i get a compiler error 1120 access to undefined property  
How do i make that code work in AS 3?

it works if i call out the properites like this:

```auto

private function makeNewFormat(formatForField:TextField){
	var formatName:TextFormat = new TextFormat();
			
	formatName.font = "Verdana";
	formatName.color = 0xFF0000;
	formatName.size = 10;
			
	formatForField.setTextFormat(formatName);
}

```

but obviously that restricts the flexibility the other function offers me.

any ideas?
