# New to AS, trying to use OOP, not working

**URL:** https://forum.kirupa.com/t/new-to-as-trying-to-use-oop-not-working/168266
**Category:** Uncategorized
**Created:** [November 5, 2005, 6:03pm UTC](https://forum.kirupa.com/t/new-to-as-trying-to-use-oop-not-working/168266 "2005-11-05T18:03:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![johnnyICON](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@johnnyICON](https://forum.kirupa.com/u/johnnyICON)
#### Post date: [November 5, 2005, 6:03pm UTC](https://forum.kirupa.com/t/new-to-as-trying-to-use-oop-not-working/168266/1 "2005-11-05T18:03:19Z")

</div>

Hi, I am trying to do some OO programming in Flash. I have made a separate file named Picture.as with the following code inside of it:

```auto
class Picture
{
	private	var p_url:String = "";
	private var p_width:Number = 0;
	private var p_height:Number	= 0;
	private var p_caption:String	= "";

	public function Picture(pURL:String, pCAPTION:String)
	{
		p_url = pURL;
		p_caption = pCAPTION;
		toString();
	}

	public function toString():String
	{
		return p_url + ", " + p_width + ", " + p_height + ", " + p_caption;
	}

}

```

I typed this in Flash  
#include “Picture.as”

The flash file and the .as file are both in the same directory. I hit ctrl+enter and I get:

```auto
**Error** Symbol=pictureHolder, layer=Layer 1, frame=1:Line 1: Classes may only be defined in external ActionScript 2.0 class scripts.
	 class Picture

**Error** F:	he DiZO\Production\Design\johnnyICON\slideshow\Picture.as: Line 1: Classes may only be defined in external ActionScript 2.0 class scripts.
	 class Picture

**Error** F:	he DiZO\Production\Design\johnnyICON\slideshow\Picture.as: Line 2: The name of this class, 'Picture', conflicts with the name of another class that was loaded, 'Picture'.
	 {

Total ActionScript Errors: 3 Reported Errors: 3

```

I don’t know what’s going on 😃 probably something simple for all of you, but it’s something that i don’t know about. =) thanks in advance for any help.
