Using textbox values?

I made this drawing application:

http://hundsteg.se/Erik/draw_thingy.html

Too train my AS knowladge. You can resize the window and the objects should stay fixed to the corners. Use your Mousewheel/scroller to resize the brush.

Now what I would like to do is ad a text box to enter hex values to change the color. And a text box to display current color.

I cant quite figure out how to tie the two together though. I tried giving the input text a instance and then just using that instance = my variable for color. But it didnt work out, I’ve really just been guessing as I didnt find a guide on it.

Heres the code if anyone is intrested:

// starting setup
Stage.scaleMode = "noScale";
Stage.align = "TL";
this.createEmptyMovieClip("thedrawing", 100);
var Drawing_in_progress:Boolean = false;
var thick = 3;
var thecolor = 0xFF0000;
var thealpha = 100;
//reset
reset.onRelease = function() {
    thedrawing.clear();
};
// alpha
_root.uptext.onPress = function() {
    thealpha += 10;
};
_root.downtext.onPress = function() {
    thealpha -= 10;
};
// colors
_root.pallete.red.onPress = function() {
    thecolor = 0xFF0000;
};
_root.pallete.blue.onPress = function() {
    thecolor = 0x0000FF;
};
_root.pallete.green.onPress = function() {
    thecolor = 0x00FF00;
};
_root.pallete.yellow.onPress = function() {
    thecolor = 0xFFFF00;
};
_root.pallete.purple.onPress = function() {
    thecolor = 0x9900FF;
};
_root.pallete.white.onPress = function() {
    thecolor = 0xFFFFFF;
};
_root.pallete.black.onPress = function() {
    thecolor = 0x000000;
};
_root.pallete.cyan.onPress = function() {
    thecolor = 0x00FFFF;
};
//the drawing
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
    thedrawing.moveTo(_xmouse, _ymouse);
    Drawing_in_progress = true;
    thedrawing.lineStyle(thick, thecolor, thealpha);
};
mouseListener.onMouseMove = function() {
    if (Drawing_in_progress == true) {
        thedrawing.lineTo(_xmouse, _ymouse);
        updateAfterEvent();
    }
};
mouseListener.onMouseUp = function() {
    Drawing_in_progress = false;
};
Mouse.addListener(mouseListener);
// thickness rezise
my_listener = new Object();
Mouse.addListener(my_listener);
my_listener.onMouseWheel = function(delta) {
    if ((_root._xscale+delta<200) && (delta>0)) {
        thick += delta;
    } else if ((_root._xscale-delta*5>50) && (delta<0)) {
        thick += delta;
    }
};
//location initial
pallete._x = Stage.width-100;
pallete._y = Stage.height-30;
reset._x = Stage.width-55;
alphatext._y = Stage.height-15;
uptext._y = Stage.height-15;
downtext._y = Stage.height-15;
//location change
stageListener = new Object();
stageListener.onResize = function() {
    Stage.align = "TL";
    pallete._x = Stage.width-100;
    pallete._y = Stage.height-30;
    reset._x = Stage.width-55;
    alphatext._y = Stage.height-15;
    uptext._y = Stage.height-15;
    downtext._y = Stage.height-15;
};
Stage.addListener(stageListener);

I wrote it myself from various guides. Its my first real code beyond like 5 or so lines =).

So if anyone could tell me how to use textboxe’s values I would really appriciate it. Or if someone could just direct me to a guide.

Thanks =)!

edit: I cant figure out how to limit the alpha value either, right now you can click yourself down to a unlimited negative/posetive number. Anyone :angel:?