Hi,
I made the following class but would like to return a textformat from another class:
package my.fonts {
import flash.display.*;
import flash.text.*;
public class TextStyle extends TextFormat {
[Embed(source="/home/john/.fonts/WinAdobeFonts/arial.ttf", fontFamily="interpretation", mimeType="application/x-font-truetype")]
private var MyFont:Class;
public function TextStyle(ftSize:Number = 12):TextFormat {
var Fmt:TextFormat = new TextFormat();
Fmt.font = "interpretation";
Fmt.size = ftSize;
Fmt.bold = false;
return Fmt;
}
}
}
The compiler tells me that I can’t return anything from a method, but then how can I get to just set a variable like this from my main class:
var myFormat:TextStyle = new TextStyle(16);
and then use it with a textfield:
myTextField.defaultTextFormat = myFormat;
Thanks,