# Can't return text format?

**URL:** <https://forum.kirupa.com/t/cant-return-text-format/276043>\
**Category:** Uncategorized\
**Created:** [November 21, 2008, 5:15pm UTC](https://forum.kirupa.com/t/cant-return-text-format/276043 "2008-11-21T17:15:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Didi32](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Didi32](https://forum.kirupa.com/u/Didi32)\
**Post date:** [November 21, 2008, 5:15pm UTC](https://forum.kirupa.com/t/cant-return-text-format/276043/1 "2008-11-21T17:15:19Z")

</div>

Hi,

I made the following class but would like to return a textformat from another class:

```auto
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:

```auto
var myFormat:TextStyle = new TextStyle(16);

```

and then use it with a textfield:

```auto
myTextField.defaultTextFormat = myFormat;

```

Thanks,
