# \[Flash 9 AS 2\]format text in dynamic field not working

**URL:** https://forum.kirupa.com/t/flash-9-as-2-format-text-in-dynamic-field-not-working/249145
**Category:** flash
**Created:** [January 15, 2008, 8:50pm UTC](https://forum.kirupa.com/t/flash-9-as-2-format-text-in-dynamic-field-not-working/249145 "2008-01-15T20:50:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ambivert](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@ambivert](https://forum.kirupa.com/u/ambivert)
#### Post date: [January 15, 2008, 8:50pm UTC](https://forum.kirupa.com/t/flash-9-as-2-format-text-in-dynamic-field-not-working/249145/1 "2008-01-15T20:50:35Z")

</div>

I am trying to change the text format in an AS-created text field and it is not working. I got the codes right out of the help files. what am I doing wrong?

var my\_sound:Sound = new Sound();  
my\_sound.loadSound(“lockhart.mp3”, true);

this.createEmptyMovieClip(“knob\_mc”, this.getNextHighestDepth());

knob\_mc.left = knob\_mc.\_x;  
knob\_mc.right = knob\_mc.left+100;  
knob\_mc.top = knob\_mc.\_y;  
knob\_mc.bottom = knob\_mc.\_y;

knob\_mc.\_x = my\_sound.getVolume();

with (knob\_mc) {  
lineStyle(0, 0x000000);  
beginFill(0xFFCCFF);  
moveTo(0, 580);  
lineTo(8, 580);  
lineTo(8, 596);  
lineTo(0, 596);  
lineTo(0, 580);  
endFill();  
}

knob\_mc.createTextField(“volume\_txt”, knob\_mc.getNextHighestDepth(), knob\_mc.\_width+4, 580, 30, 22);  
format = new TextFormat();  
format.color = 0xFFCCFF;  
knob\_mc.volume\_txt.setTextFormat(format);  
knob\_mc.volume\_txt.text = my\_sound.getVolume();

knob\_mc.onPress = function() {  
this.startDrag(false, this.left, this.top, this.right, this.bottom);  
this.isDragging = true;  
};  
knob\_mc.onMouseMove = function() {  
if (this.isDragging) {  
this.volume\_txt.text = this.\_x;  
}  
}  
knob\_mc.onRelease = function() {  
this.stopDrag();  
this.isDragging = false;  
my\_sound.setVolume(this.\_x);

};
