# Brush size change and undo for paint app

**URL:** <https://forum.kirupa.com/t/brush-size-change-and-undo-for-paint-app/188478>\
**Category:** flash\
**Created:** [May 8, 2006, 9:52am UTC](https://forum.kirupa.com/t/brush-size-change-and-undo-for-paint-app/188478 "2006-05-08T09:52:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fireblade87](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/fireblade87/32/1191_2.png) [@Fireblade87](https://forum.kirupa.com/u/Fireblade87)\
**Post date:** [May 8, 2006, 9:52am UTC](https://forum.kirupa.com/t/brush-size-change-and-undo-for-paint-app/188478/1 "2006-05-08T09:52:12Z")

</div>

Hey guys im currently developing a flash paint app for the psp and im stuck in a little rut here i need a way to allow the user to change brush size depending on what they press aka if they press pencil get a thin line stroke, if big brush big line stroke is there anyway of doing this?

and the next one how can i make a undo button so it undos the last line done

here my code so far

```auto
//starting color is black
var colorChoise=0x000000;
_root.createEmptyMovieClip("line", 1);
_root.onMouseDown = function() {
    line.moveTo(_xmouse, _ymouse);
    line.lineStyle(2, colorChoise, 100);
    this.onMouseMove = function() {
        line.lineTo(_xmouse, _ymouse);
        updateAfterEvent();
    };
};
_root.onMouseUp = function() {
    this.onMouseMove = null;
};
buttonErase.onPress = function() {
    _root.line.clear();
};
red.onRelease = function() {
    colorChoise = 0xFF0000;
};
green.onRelease = function() {
    colorChoise = 0x00CC00;
};
blue.onRelease = function () {
    colorChoise = 0x0033FF;
};
yellow.onRelease= function () {
    colorChoise = 0xFFFF00;
};
purple.onRelease = function () {
    colorChoise = 0xFF00FF;
};
pink.onRelease = function () {
    colorChoise = 0x9933FF;
};
samon.onRelease = function () {
    colorChoise = 0xFF99CC;
};
black.onRelease = function () {
    colorChoise = 0x000000;
};
lgreen.onRelease = function () {
    colorChoise = 0x99FF99;
};
grey.onRelease = function () {
    colorChoise = 0xD0D0D0;
};
lblue.onRelease = function () {
    colorChoise = 0xCCFFFF;
};
orange.onRelease = function () {
    colorChoise = 0xFF6600;
};

```

thanks a lot for your help  
fireblade

---

<div class="post-metadata">

**Author:** ![Fireblade87](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/fireblade87/32/1191_2.png) [@Fireblade87](https://forum.kirupa.com/u/Fireblade87)\
**Post date:** [May 11, 2006, 8:52pm UTC](https://forum.kirupa.com/t/brush-size-change-and-undo-for-paint-app/188478/2 "2006-05-11T20:52:38Z")

</div>

hey sorry a bit offtopic  
oh can i lock the drawing area so there not drawing all over the swf document just on made canvas? i know its gunna be simple but mind aint working right lol

---

<div class="post-metadata">

**Author:** ![theflash](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/theflash/32/1221_2.png) [@theflash](https://forum.kirupa.com/u/theflash)\
**Post date:** [May 12, 2006, 7:31am UTC](https://forum.kirupa.com/t/brush-size-change-and-undo-for-paint-app/188478/3 "2006-05-12T07:31:30Z")

</div>

You will have to tweak… hitTest for the restricted area… or you can startDrag a dummy dot and ristrict the stratDrag area in the function itself and drawing only the positions of that dot
