I have alot(1000+) of textfields and that itself seems to be using up 100% of the cpu. Also when my cursor is over a button the cpu usage actually went down to about 70%. But if I rollout of the button, the cpu usage goes back to 100%. Why is this?
The following is my textfield class.
package Classes {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
public class CbasicTextField extends Sprite {
private var oRender:Object;
private var myTextField:TextField;
private var myTextFieldContainer:MovieClip;
private var myText:String;
private var textType:uint;
private var xPos:Number;
private var yPos:Number;
public function CbasicTextField(oRender:Object, myText:String, textType:uint, xPos:Number, yPos:Number) {
this.oRender = oRender;
this.myText = myText;
this.textType = textType;
this.xPos = xPos;
this.yPos = yPos;
this.configureMyTextField();
this.myTextField.text = this.myText;
this.myTextFieldContainer.x = this.xPos;
this.myTextFieldContainer.y = this.yPos;
}
public function getWidth():Number {
return this.myTextField.width;
}
public function getTextFieldContainer():MovieClip {
return this.myTextFieldContainer;
}
public function remove():void {
this.oRender.removeChild(this.myTextFieldContainer);
}
private function configureMyTextField():void {
this.myTextField = new TextField();
this.myTextField.autoSize = TextFieldAutoSize.LEFT;
this.myTextField.selectable = false;
//myTextField.border = true;
var format:TextFormat = new TextFormat();
if (textType == 0) { // smallest text(for buttons, and rants)
format.font = "somybmp02_7";
format.color = 0xFFFFFF;
format.size = 7;
} else if (textType == 1) { // for titles
format.font = "PF Ronda Seven";
format.color = 0xFFFFFF;
format.size = 8;
}
this.myTextField.defaultTextFormat = format;
this.myTextFieldContainer = new MovieClip();
this.myTextFieldContainer.addChild(this.myTextField)
this.oRender.addChild(this.myTextFieldContainer);
}
}
}