Ultrashock Forums > Flash > ActionScript
AS3 - TextFormat extending TextField class.

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS3 - TextFormat extending TextField class.
Old 2008-09-12

hey all,

I have custom inputText class created extending Sprite which works fine and i can asign whatever text format that i want which is stored in an all-static TextValues class.

Now i am trying to create custom labeling class where i do not need anything from Sprite just text and text formating. Followed pretty much the same steps as the previous class that i've created but the text format just doesnt seem to work. Is there any reason why it works while extending Sprite and doesnt work when extending TextField ? Any suggestions? AS below:


GroupLabel class which creates the label that i need.
Code:
package com.Graphics{

	import flash.text.*;
	import com.Graphics.TextValues;


	public class GroupLabel extends TextField{

		public var GROUPLABEL:TextField = new TextField();

		public function GroupLabel(labelText:String = "Group Lable"):void {
			
		GROUPLABEL.wordWrap = false;
		GROUPLABEL.type = TextFieldType.DYNAMIC;
		GROUPLABEL.x = 0;
		GROUPLABEL.y = 0;
		GROUPLABEL.tabEnabled = true;
		GROUPLABEL.setTextFormat(TextValues.labelFormat);

		
		}
	}
}

TextValues class which stores all of the text formating. As i mentioned before i can asing the formats from this class and it works ok but for some reason the class above just wont asing any of the formating.
Code:
package com.Graphics{

	import flash.text.TextFormat;
	import com.Graphics.ColorValues;
	
	public class TextValues {
		
		public static var groupFormat:TextFormat = new TextFormat();
		groupFormat.font = "Arial";
		groupFormat.bold = true;
		groupFormat.color = 0x000000;
		groupFormat.size = 50;
		
		public static var labelFormat:TextFormat = new TextFormat();
		labelFormat.font = "Arial";
		labelFormat.bold = true;
		labelFormat.color = 0x000000;
		labelFormat.size = 12;
		
	}
}
Thanks for any help!
postbit arrow Be the first to comment! | 4233 views postbit arrow Reply: with Quote   
Registered User
carenot is offline
seperator
Posts: 75
2006-09-18
Age: 22
seperator
Thread Tools
Display Modes Rate This Thread
Rate This Thread: