# How to controll Selection Color with AS

**URL:** <https://forum.kirupa.com/t/how-to-controll-selection-color-with-as/171440>\
**Category:** flash\
**Created:** [December 5, 2005, 3:10pm UTC](https://forum.kirupa.com/t/how-to-controll-selection-color-with-as/171440 "2005-12-05T15:10:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceko](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@ceko](https://forum.kirupa.com/u/ceko)\
**Post date:** [December 5, 2005, 3:10pm UTC](https://forum.kirupa.com/t/how-to-controll-selection-color-with-as/171440/1 "2005-12-05T15:10:30Z")

</div>

I need to colorize the selection of a text.

The default colors for a selected text are white for text and black for the surrounding border.

I need to customize the surrounding border to a desired color.

Now:

On the stage I have a dynamic text box with “mytext” instance and a movie clip. off course I have some text inside the dynamic text box

On the first keyframe I have this code: (thank you, [senocular](http://www.senocular.com/flash/actionscript.php) !!!)

```auto
 
TextField.prototype.selectAll = function(){ 
	 Selection.setFocus(this); 
	 Selection.setSelection(10,this.length-20); 
	 **Selection.setSelectColor(0x993377); //here is the problem**
}

```

on the movie clip I have this code:

```auto
 onClipEvent(enterFrame){
_root.mytext.selectAll();
}

```

If I remove the \*\*"Selection.setSelectColor(0x993377); " \*\*line, everything is ok except the fact that the selection border is not colorized. If I leave that line, I encounter a strange error: “_There is no method with the name ‘setSelectColor’._”

How can I do to set a selection within a textbox and also to set the color of the selection background?

thank you in advance!
