# Var a:Item = new Item("Business", "+", textsize, color, alignment)

**URL:** <https://forum.kirupa.com/t/var-a-item-new-item-business-textsize-color-alignment/268630>\
**Category:** Uncategorized\
**Created:** [August 16, 2008, 5:30am UTC](https://forum.kirupa.com/t/var-a-item-new-item-business-textsize-color-alignment/268630 "2008-08-16T05:30:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![florencec2046](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@florencec2046](https://forum.kirupa.com/u/florencec2046)\
**Post date:** [August 16, 2008, 5:30am UTC](https://forum.kirupa.com/t/var-a-item-new-item-business-textsize-color-alignment/268630/1 "2008-08-16T05:30:25Z")

</div>

Hi all,

I am new to AS3 and have spent a few weeks to figure out how to create a class which have 2 TextFields - the first textfield is either a “+” or " " and the second one is some text … Since there are over 50 items, I think it will be good to create a class instead of using symbols in flash. I need to adjust the font size, font color, alignment, rotation inside the class.

Example :

var a:Item = new Item(“Business”, “+”, textsize, color, alignment,rotation)

I have the following code which works in timeline but don’t know how to put it in a class…

Can anyone help me out… Thanks in advance !!!

* * *

var element01:Sprite = new Sprite();

addChild(element01);

var cFont:String = “Arial”;  
var cTitle:uint = 0x999999;  
var cContent:uint = 0xc4b789;  
var cContainer:uint = 0x7c7f4f;  
var c12:uint = 12;  
var c10:uint = 10;

var myFont:Font = new EmbedArial();

var txtFmt\_gContainer:TextFormat = new TextFormat();  
txtFmt\_gContainer.font = myFont.fontName;  
txtFmt\_gContainer.size = 24;  
txtFmt\_gContainer.font = cFont;  
txtFmt\_gContainer.color = cContainer;  
txtFmt\_gContainer.size = c10;  
txtFmt\_gContainer.align = “right”;

var item:TextField = new TextField();

item.autoSize = TextFieldAutoSize.LEFT;  
item.defaultTextFormat = txtFmt\_gContainer;  
item.embedFonts = true;  
item.text = “business”;  
element01.addChild(item);

item.x = 10;  
item.y = -10;

item.rotation = -8;

var sign:TextField = new TextField();

sign.autoSize = TextFieldAutoSize.LEFT;  
sign.defaultTextFormat = txtFmt\_gContainer;  
sign.embedFonts = true;  
sign.text = “+”;  
element01.addChild(sign);

* * *

Florence
