# Class in Action script 3

**URL:** <https://forum.kirupa.com/t/class-in-action-script-3/313971>\
**Category:** flash\
**Created:** [September 15, 2010, 5:26am UTC](https://forum.kirupa.com/t/class-in-action-script-3/313971 "2010-09-15T05:26:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramukumar](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@ramukumar](https://forum.kirupa.com/u/ramukumar)\
**Post date:** [September 15, 2010, 5:26am UTC](https://forum.kirupa.com/t/class-in-action-script-3/313971/1 "2010-09-15T05:26:37Z")

</div>

Hi All  
I am new to action script 2.o  
please help me in the following coding  
in .fla the code is

```auto

var trail:threedots = new threedots();

trail.drawtri();
onMouseMove = function(){
    trail.MouseMove();
}

onEnterFrame = function(){
    trail.EnterFrame();
}
onMouseDown=function()
{
    trail.MouseDown();
}

btnReset.onPress=function()
{
    trail.btnReset1();
}

```

in .as file

```auto

class threedots extends MovieClip
{
    public var a1:Number ;
    public var a2:Number ;
    public var a3:Number ;
    public var b1:Number ;
    public var b2:Number ;
    public var b3:Number ;
    public var c1:Number ;
    public var c2:Number ;
    public var c3:Number ;
    public var dragging:Number;
    public var triangle:Boolean;
    public var clicks:Number = 0;

    
    function threedots() 
    {
        
  }

function drawtri():Void
{
    if(clicks>=3)
    var t:MovieClip = createEmptyMovieClip("triangle", 1);
t.beginFill(0x0066cc);
//draw a triangle
t.lineStyle(2, 0x000033, 100);
t.moveTo(a1, b1);
t.lineTo(a2, b2);
t.lineTo(a3, b3);
t.lineTo(a1, b1);
t.endFill();
t._x = 0;
t._y = 0;
}

function MouseMove():Void{

    if(dragging==1)
    {
        a1=_xmouse;
        b1=_ymouse;
    }
    if(dragging==2)
    {
        a2=_xmouse;
        b2=_ymouse;
    }
    if(dragging==3)
    {
        a3=_xmouse;
        b3=_ymouse;
    }
    
    drawtri();
    

}
function EnterFrame():Void{

    drawtri();

}

function MouseDown():Void
{
    clicks++;
    
    switch(clicks)
    {
        case 1:
        a1=_xmouse;
        b1=_ymouse;
        {
            createEmptyMovieClip("c1", 2);
            // center point and radius of circle
            var r:Number = 5;
            var x:Number = a1;
            var y:Number = b1;
            // constant used in calculation
            var A:Number = Math.tan(22.5 * Math.PI/180);
            // variables for each of 8 segments
            var endx:Number;
            var endy:Number;
            var cx:Number;
            var cy:Number;

            c1.beginFill(0xff0000);
            c1.moveTo(x+r, y);
            for (var angle:Number = 45; angle<=360; angle += 45) {
           // endpoint
           endx = r*Math.cos(angle*Math.PI/180);
           endy = r*Math.sin(angle*Math.PI/180);
           // control:
           // (angle-90 is used to give the correct sign)
           cx =endx + r* A *Math.cos((angle-90)*Math.PI/180);
           cy =endy + r* A *Math.sin((angle-90)*Math.PI/180);
           c1.curveTo(cx+x, cy+y, endx+x, endy+y);
            }
            c1.endFill();
            c1.onPress=function()
            {
            c1.startDrag();
            dragging=1;
            }
            
            c1.onRelease=function()
            {
                c1.stopDrag();
                dragging=0;
                
            }
        }
        break;
        
        case 2:
        a2=_xmouse;
        b2=_ymouse;
        {
            createEmptyMovieClip("c2", 3);
            // center point and radius of circle
            var r:Number = 5;
            var x:Number = a2;
            var y:Number = b2;
            // constant used in calculation
            var A:Number = Math.tan(22.5 * Math.PI/180);
            // variables for each of 8 segments
            var endx:Number;
            var endy:Number;
            var cx:Number;
            var cy:Number;

            c2.beginFill(0xff0000);
            c2.moveTo(x+r, y);
            for (var angle:Number = 45; angle<=360; angle += 45) {
           // endpoint
           endx = r*Math.cos(angle*Math.PI/180);
           endy = r*Math.sin(angle*Math.PI/180);
           // control:
           // (angle-90 is used to give the correct sign)
           cx =endx + r* A *Math.cos((angle-90)*Math.PI/180);
           cy =endy + r* A *Math.sin((angle-90)*Math.PI/180);
           c2.curveTo(cx+x, cy+y, endx+x, endy+y);
            }
            c2.endFill();
            c2.onPress=function()
            {
            c2.startDrag();
            dragging=2;

            }
            
            
            c2.onRelease=function()
            {
                c2.stopDrag();
                dragging=0;
                
            }
        }
        
        break;
        case 3:
        a3=_xmouse;
        b3=_ymouse;
        
        
        {
            createEmptyMovieClip("c3", 4);
            // center point and radius of circle
            var r:Number = 5;
            var x:Number = a3;
            var y:Number = b3;
            // constant used in calculation
            var A:Number = Math.tan(22.5 * Math.PI/180);
            // variables for each of 8 segments
            var endx:Number;
            var endy:Number;
            var cx:Number;
            var cy:Number;
            c3.beginFill(0xff0000);
            c3.moveTo(x+r, y);
            for (var angle:Number = 45; angle<=360; angle += 45) {
           // endpoint
           endx = r*Math.cos(angle*Math.PI/180);
           endy = r*Math.sin(angle*Math.PI/180);
           // control:
           // (angle-90 is used to give the correct sign)
           cx =endx + r* A *Math.cos((angle-90)*Math.PI/180);
           cy =endy + r* A *Math.sin((angle-90)*Math.PI/180);
           c3.curveTo(cx+x, cy+y, endx+x, endy+y);
            }
            c3.endFill();
            
            c3.onPress=function()
            {
            c3.startDrag();
            dragging=3;

            }

            c3.onRelease=function()
            {
                a3=_xmouse;
                b3=_ymouse;
                dragging=0;
                c3.stopDrag();
                
            }            
}
        
        
        break;
        default:
    }
    trace(_xmouse+"-"+_ymouse);
}

function btnReset1()
{
    clicks=0;
    triangle._visible=false;
    c1._visible=false;
    c2._visible=false;
    c3._visible=false;
}
}

```

when i compied i got the following error

```auto

C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 93 There is no method with the name 'beginFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 94 There is no method with the name 'moveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 103 There is no method with the name 'curveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 105 There is no method with the name 'endFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 106 There is no property with the name 'onPress'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 112 There is no property with the name 'onRelease'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 138 There is no method with the name 'beginFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 139 There is no method with the name 'moveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 148 There is no method with the name 'curveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 150 There is no method with the name 'endFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 151 There is no property with the name 'onPress'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 159 There is no property with the name 'onRelease'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 186 There is no method with the name 'beginFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 187 There is no method with the name 'moveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 196 There is no method with the name 'curveTo'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 198 There is no method with the name 'endFill'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 200 There is no property with the name 'onPress'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 207 There is no property with the name 'onRelease'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 227 There is no property with the name '_visible'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 228 There is no property with the name '_visible'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 229 There is no property with the name '_visible'.
C:\Users\Ramukumar\Documents\Downloads\Compressed	hree dots by naveen_21	hree dots by naveen	hreedots.as, Line 230 There is no property with the name '_visible'.

```

Thanks & Regards  
Ramu:hugegrin:
