# Simple class Rectangle - little error

**URL:** <https://forum.kirupa.com/t/simple-class-rectangle-little-error/295935>\
**Category:** flash\
**Created:** [September 7, 2009, 5:39pm UTC](https://forum.kirupa.com/t/simple-class-rectangle-little-error/295935 "2009-09-07T17:39:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihaispr](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mihaispr](https://forum.kirupa.com/u/mihaispr)\
**Post date:** [September 7, 2009, 5:39pm UTC](https://forum.kirupa.com/t/simple-class-rectangle-little-error/295935/1 "2009-09-07T17:39:39Z")

</div>

I have designing a class Rectangle (i have 2 files Rectangle.as and Rectangle.fla that I have in the same directory added in classpath in the menu Edit-\>Preferences-\>Actionscript tab-\>Actionscript 2.0 settings and I added the exactly path where I have the 2 files). This is not my problem.

I have here my 2 files: (in the same location as you can see very well)

![](http://img338.imageshack.us/img338/9642/locationfiles.png)

I added this class path like that (is the first path):

![](http://img412.imageshack.us/img412/6145/classpath.png)

It’s the name of the folder from first picture above but it’s not seeing the entire path. Hope it’s ok until now.

And now to expose my real problem:

My problem is when I try to compile my .fla file I receive an error.

First I list the 2 files (Rectangle.as and Rectangle.fla):

Contents of file Rectangle.as:

```auto

class Rectangle
{ private var mcContainer:MovieClip;

function resize(xscale:Number, yscale:Number):Void
{mcContainer._xscale = xscale;
mcContainer._yscale = yscale;
}

function Rectangle(x1:Number,y1:Number,x2:Number,y2:Number)
{var d:Number = _root.getNextHighestDepth(); // ca sa nu inlocuim cu un alt
//simbol movieclip
mcContainer = _root.createEmptyMovieClip("container"+d,d);
mcContainer = lineStyle(lineWidth,lineColor);
mcContiner.moveTo(x1,y1);
mcContiner.lineTo(x2,y1);
mcContiner.lineTo(x2,y2);
mcContiner.lineTo(x1,y2);
mcContiner.lineTo(x1,y1);

}

```

Contents of Rectangle.fla:

```auto

// in fisierul.fla definim obiectele si apelam functiile membru

// e un fel de program principal

// fisierul .as contine clasa cu date membru si functii membru

import mx.*; // import the class defined in Rectangle.as mx is the folder that I store first //printscreen where I have the 2 files

private lineWidth:Number = 5; // grosimea liniei cu care trasam forma
private lineColor:Number = 0xFF0000; // culoarea rosie

var obiect_rectangle:Rectangle = new Rectangle(10,10,100,100);
obiect_rectangle.resize(300,300);

var obiect_rectangle2:Rectangle = new Rectangle(50,50,120,120);
obiect_rectangle2.resize(200,200);

```

And when I press CTRL+ENTER to run Rectangle.fla which contains instances of my class Rectangle (made in Rectangle.as) I receive that error:

```auto
Attribute used outside class.

```

And the line that tells me the error is this:

```auto

private lineWidth:Number = 5; // from Rectangle.fla file here is the error

```

Where I made the mistake? Please help me to solve this problem so that I run in good conditions my Rectangle class.

How can I modify the contents of the two files to be all ok?

I struggle for an hour to deal with that and I don’t see the solution.

Thanks for reading my long thread but hope I give all the necessary details in order to help me.

Thanks in advance!

Michael

I tried also in my Rectangle file using :

#include “Rectangle.as”

But the same error appear.

Pls I really need help all my post have the same error but in other cases!

So pls help me with this thing I’m stuck because I’m lack of ideas.
