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:
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:
**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.