Nevermind got it working.
moderators you can delete this thread
in AS 2 I used to be able to do this
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:
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?