# I need to convert AS 2.0 code to 3.0

**URL:** <https://forum.kirupa.com/t/i-need-to-convert-as-2-0-code-to-3-0/242360>\
**Category:** flash\
**Created:** [October 25, 2007, 4:34am UTC](https://forum.kirupa.com/t/i-need-to-convert-as-2-0-code-to-3-0/242360 "2007-10-25T04:34:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nykol86](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nykol86](https://forum.kirupa.com/u/nykol86)\
**Post date:** [October 25, 2007, 4:34am UTC](https://forum.kirupa.com/t/i-need-to-convert-as-2-0-code-to-3-0/242360/1 "2007-10-25T04:34:54Z")

</div>

I would like to incorporate a very basic paint program into my Flash movie.  
I must use AS 3.0.

I followed the tutorial from the URL below, which I think is for AS 2.0.  
[url=“[http://www.pixelhivedesign.com/tutorials/Flash+Painting+Program/](http://www.pixelhivedesign.com/tutorials/Flash+Painting+Program/)”]

It doesn’t even work for me using AS 2.0. When I try to play my movie it says “A script in this movie is causing Adobe Flash Player 9 to run slowly. If it continues to run your computer may become unresponsive. Do you want to abort the script?”

The code in the tutorial is:  
[COLOR=Blue]canvasAbove = attachMovie(‘canvas\_mc’,‘can’,2);  
canvasAbove.\_alpha = 50;

painting = createEmptyMovieClip(‘painting’,1);

theBrush = new Object();  
theBrush.onMouseDown = function(){  
isPainting = true;  
painting.moveTo(\_xmouse,\_ymouse);  
painting.lineTo(\_xmouse+1,\_ymouse+1);  
}  
theBrush.onMouseMove = function(){  
if(isPainting){  
painting.lineTo(\_xmouse,\_ymouse);  
}  
}  
theBrush.onMouseUp = function(){  
isPainting = false;  
}  
Mouse.addListener(theBrush);

painting.onEnterFrame = function(){  
ranWidth = Math.round((Math.random() \* 10)+2);  
painting.lineStyle(ranWidth,0x006600,100);  
}

clear\_btn.onRelease = function(){  
painting.clear();  
}[/COLOR]

Can anybody help me to convert this code into Actionscript 3.0?  
Or do you have an alternative way to make a basic drawing program using AS3.0 and Flash?

Thank you,  
Nicole
