Using just a set of functions is not oop. It's rather procedural
programming. However it works, it is difficult to reuse or make
something really large scale or cooperate with other programmers
basing on procedural code. You can write procedural-AS3, but there is
not point of doing that. And you would have to place all library item
on the stage, name them (properties -> instance name) and do stuff
with them.
Beno...
The difference is that in oop you have various classes that may (but
not necessarily) construct their instance objects. Classes have their own
methods (functions of classes) and their own properties (like
variables of classes). Any object "constructed" by a class "has" all
these methods and properties.
In AS2 and AS3 both methods and properties may be private or public
(there are more than that two in AS3, but basically let's consider
private and public).
Now you can consider a class called Dog. The class Dog has methods
startBarking() and stopBarking(). Its instance can do all that its
class define:
var instanceOfDog : Dog = new Dog();
//(instance name)^ (type)^ (class)^
instanceOfDog.startBarking();
///.... and somewhere later
instanceOfDog.stopBarking();
... and you can create another instance of Dog, but the new instance is a
completely separate object (they do not bark at once, for example).
---
Local variables are those that you create temporally in a function/method
body. Other functions/methods do not see these variables. They are
visible only in the scope of one function/method after being declared
until the function ends:
function fun1()
{
// here nobody has seen rolf yet...
var rolf:Dog = new Dog(); //of course you have to import
//your Dog class before instantiating it
// (.) here the compiler sees rolf because has a reference to it
// in the computer memory.
}
function fun2()
{
// in this function (or method) nobody knows about rolf's
// existance...
}
... I have to end here. This is a longer story. Use google to reach
tutorials about "AS3 object oriented programming basics".
g
Wednesday, December 09, 2009 (4:50:44 PM) beno- wrote:
> On Wed, Dec 9, 2009 at 11:27 AM, Matt S. <[email protected]> wrote:
>> On Wed, Dec 9, 2009 at 10:20 AM, beno - <[email protected]> wrote:
>> >> You are correct. I don't fully understand classes, although I doubt I'm
>> far
>> > from it. I will google what you have suggested. Thank you!
>> >
>>
>> Didnt you say: "I have many years working with python"? Were you able
>> to do that without touching oop or classes, "beno"?
>>
> I'm ashamed to admit it, yes. I might very well be working in classes and
> what I'm doing in python could very well be oop, but I've never studied it
> as such and I obviously need to. I write all sorts of things like:
> def whatever(var, var2):
> stuff here
> and call that from other functions. If that's classes and oop, then I've
> been all over that for years. I dunno <:-}
> We're OT again <caution>
> beno
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders