I think this is an important question and it therefore demands a serious answer.
Sunil, please change the message subject appropriately next time you start a thread. I almost didn't read your question.
For the question to be answered we need to know enough about the formal specification of ActionScript. This is the ECMA-262 standard specification (available at www.ecma.ch). This standard is also an ISO standard (ISO 16262). Both ActionScript and JavaScript/JScript are compliant to the ECMAScript standard.
Following is a quick overview of the standard formed by cut/pasted parts of the document that describes the ECMA-262 standard. Titles for the text excerpts are provided by me. Note that the standard itself refers to ECMAScript as "Object Oriented".
<START_ECMA_OVERVIEW>
HISTORICAL BACKGROUND
This ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0.
INTRO
ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects within a host environment. ECMAScript as defined here is not intended to be computationally self-sufficient; indeed, there are no provisions in this specification for input of external data or output of computed results. Instead, it is expected that the computational environment of an ECMAScript program will provide not only the objects and other facilities described in this specification but also certain environment-specific host objects, whose description and behaviour are beyond the scope of this specification except to indicate that they may provide certain properties that can be accessed and certain functions that can be called from an ECMAScript program.
A scripting language is a programming language that is used to manipulate, customise, and automate the facilities of an existing system. In such systems, useful functionality is already available through a user interface, and the scripting language is a mechanism for exposing that functionality to program control. In this way, the existing system is said to provide a host environment of objects and facilities, which completes the capabilities of the scripting language. A scripting language is intended for use by both professional and non-professional programmers. To accommodate non-professional programmers, some aspects of the language may be somewhat less strict.
ECMAScript is object-based: basic language and host facilities are provided by objects, and an ECMAScript program is a cluster of communicating objects. An ECMAScript object is an unordered collection of properties each with zero or more attributes that determine how each property can be used— for example, when the ReadOnly attribute for a property is set to true, any attempt by executed ECMAScript code to change the value of the property has no effect. Properties are containers that hold other objects, primitive values, or methods. A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, and String; an object is a member of the remaining built-in type Object; and a method is a function associated with an object via a property. ECMAScript defines a collection of built-in objects that round out the definition of ECMAScript entities. These built-in objects include the Global object, the Object object, the Function object, the Array object, the String object, the Boolean object, the Number object, the Math object, the Date object, the RegExp object and the Error objects Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError and URIError.
ECMAScript also defines a set of built-in operators that may not be, strictly speaking, functions or methods. ECMAScript operators include various unary operations, multiplicative operators, additive operators, bitwise shift operators, relational operators, equality operators, binary bitwise operators, binary logical operators, assignment operators, and the comma operator. ECMAScript syntax intentionally resembles Java syntax. ECMAScript syntax is relaxed to enable it to serve as an easy-to-use scripting language. For example, a variable is not required to have its type declared nor are types associated with properties, and defined functions are not required to have their declarations appear textually before calls to them.
ABOUT OBJECTS
ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather, supports constructors which create objects by executing code that allocates storage for the objects and initialises all or part of them by assigning initial values to their properties. All constructors are objects, but not all objects are constructors. Each constructor has a Prototype property that is used to implement prototype-based inheritance and shared properties. Objects are created by using constructors in new expressions; for example, new String("A String") creates a new String object. Invoking a constructor without using new has consequences that depend on the constructor. For example, String("A String") produces a primitive string, not an object.
ECMAScript supports prototype-based inheritance. Every constructor has an associated prototype, and every object created by that constructor has an implicit reference to the prototype (called the object’s prototype) associated with its constructor. Furthermore, a prototype may have a non-null implicit reference to its prototype, and so on; this is called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on.
In a class-based object-oriented language, in general, state is carried by instances, methods are carried by classes, and inheritance is only of structure and behaviour. In ECMAScript, the state and methods are carried by objects, and structure, behaviour, and state are all inherited.
Unlike class-based object languages, properties can be added to objects dynamically by assigning values to them. That is, constructors are not required to name or assign values to all or any of the constructed object’s properties.
BASIC DEFINITIONS
Primitive Value
A primitive value is a member of one of the types Undefined, Null, Boolean, Number, or
String. A
primitive value is a datum that is represented directly at the lowest level of the
language implementation.
Object
An object is a member of the type Object. It is an unordered collection of properties each
of which
contains a primitive value, object, or function. A function stored in a property of an
object is called a
method.
Constructor
A constructor is a Function object that creates and initialises objects. Each constructor
has an associated
prototype object that is used to implement inheritance and shared properties.
Prototype
A prototype is an object used to implement structure, state, and behaviour inheritance in
ECMAScript.
When a constructor creates an object, that object implicitly references the constructor’s
associated
prototype for the purpose of resolving property references. The constructor’s associated
prototype can be
referenced by the program expression constructor.prototype, and properties added to an
object’s
prototype are shared, through inheritance, by all objects sharing the prototype.
</END_ECMA_OVERVIEW>
Looks like ECMAScript is OO but not in quite the conventional way (as established by
predating standards and languages like SmallTalk, ADA, C++ and recently Java and C#).
What we have seen up to now is that ECMAScript deals with objects. But is this all that OO is about? Definitely not!
Therefore, to answer the question whether it is OO or not we need to first define what OO really means.
Object Orientation, like any concept, is denoted by a series of essential characteristics. What are those characteristics?
According to the experts that define the standards, that we work with, these are:
1. DATA AND METHOD ENCAPSULATION: Classes/Objects serve as containers of ontically relevant attributes and methods. By "ontically" I mean that these data/methods are part of the identity of the object (they together define what the object itself is). For the curious, "ontic" was coined by Martin Heidegger.
This is obviously done by ECMAScript compliant script languages.
2. INFORMATION HIDING & DATA ABSTRACTION: Each class/object should have attributes and methods that are private (only accessible by code within that class/object) or public (accessible from everywhere). OO implementations can of course offer more finely grained access rules (like protected). Objects communicate with each other via their well-defined public interfaces. This accomplices what is termed as "data abstraction" whereby the concept (idea) of a specific data structure (a list for instance) is decoupled (abstracted away) from the specifics of the internal implementation (an array, a linked list, etc.). All that is visible is a standard and well defined interface.
ECMAScript and ActionScript cannot do Information Hiding really. Read-Only properties don't have anything to do with OO info hiding. The point is to be able to define variables or methods that will only be accessible from within the object/class or not. Object interfaces are there of course, but the absense of public-private declarations violates the "public object interface" and "data abstraction" concepts, and this is the whole point.
3. INHERITANCE: Basically means being able to base new classes on existing ones, inheriting their attributes and methods or overriding them.
This can be done with ECMAScript and ActionScripting via prototypes (Prototype-Based Inheritance). You can also extend existing classes or completely rewrite them.
4. POLYMORPHISM: Basically means treating an object according to its parent class(es). If later on I define a new class which inherits from (is based on) an old/existing one, then all code written for the parent class (the old class) should be applicable to the new class (or rather the objects instantiated from its constructor methods) with no problems. In strongly-typed languages this permits us to have arrays that contain different objects, e.g. an array of shapes can contain both circles and squares if the circle and square classes both inherit from the shape class.
This seems to be immediately doable in ECMAScript, but this is mainly due to the fact that ECMAScript is weakly typed, i.e. it just doesn't care much about the type of the data stored in variables. Also, the model of inheritance (as desribed in the overview) does not contradict the concept of polymorphism in any obvious way. Therfore, polymorphism is implemented in ECMAScript.
In general, a direct comparison of OO features and capabilities between ECMAScript and
professional strength programming languages (like Java or C++/C#) is difficult if not
impossible, because ECMA is weakly typed while full strength OOP languages are strongly
typed (this roughly means that they are stricter in the declarations/usage of data
types).
This difference in data typing creates difficulties (in comparing OO principle compliance between scripts and languages), partly because OO principles have been developed within and with strongly-typed languages in mind, and partly because data types and objects/classes are intricately interrelated on a conceptual level.
RESULT: ECMAScript (and therefore JavaScript and ActionScript) are ObjectOriented-ish but not "trully" Object-Oriented.
Like I said before, "trully" refers to the established-traditional understanding of what OO is.
This is what I think!
Be Cool People,
Fotios