Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-14 Thread Hans Wichman
Just on a side note, its not just -ow-what-shall-we-use-today- its a more
fundamental conceptual issue as well, such as are you dealing with a is-a
relationship or has-a or is-part-of-a etc.

I don't know if better class hierarchies change that, but maybe they
could...


On 8/13/07, T. Michael Keesey [EMAIL PROTECTED] wrote:

 On 8/13/07, Steven Sacks [EMAIL PROTECTED] wrote:
You can override the getter and/or setter of any
property: x, y, width, height, etc.
 
  This is actually one of the benefits in AS2 of using composition instead
  of inheritance with MovieClip.

 But it should be noted that there are problems with using composition,
 too. For example, you could pass control of one movie clip to more
 than one View object. (Well, in some circumstances that could be seen
 as a benefit, but I think it would usually be not so good.)

 In the end, you just have to familiarize yourself with everything, try
 different patterns, and see what makes the most sense on a
 case-by-case basis. And oftentimes there are cases where two or more
 solutions make roughly equal sense, perhaps in different ways. You
 just have to go with something and, if it later turns out to be
 awkward, refactor it.

 One last note: there are many cases where it might be better to use
 composition in AS2 but inheritance in AS3. Adobe's display classes in
 AS3 are much better set up for extension, with a far more intelligent
 class hierarchy.
 --
 Mike Keesey
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-14 Thread Zárate
Hi there,

Maybe this is spam(ish) but for those of you who are more comfortable
reading in Spanish, i wrote an open book about AS2 and OOP basics
here:

http://loqueyosede.com/as2/

Hope it helps!

Juan

On 8/14/07, Hans Wichman [EMAIL PROTECTED] wrote:
 Just on a side note, its not just -ow-what-shall-we-use-today- its a more
 fundamental conceptual issue as well, such as are you dealing with a is-a
 relationship or has-a or is-part-of-a etc.

 I don't know if better class hierarchies change that, but maybe they
 could...


 On 8/13/07, T. Michael Keesey [EMAIL PROTECTED] wrote:
 
  On 8/13/07, Steven Sacks [EMAIL PROTECTED] wrote:
 You can override the getter and/or setter of any
 property: x, y, width, height, etc.
  
   This is actually one of the benefits in AS2 of using composition instead
   of inheritance with MovieClip.
 
  But it should be noted that there are problems with using composition,
  too. For example, you could pass control of one movie clip to more
  than one View object. (Well, in some circumstances that could be seen
  as a benefit, but I think it would usually be not so good.)
 
  In the end, you just have to familiarize yourself with everything, try
  different patterns, and see what makes the most sense on a
  case-by-case basis. And oftentimes there are cases where two or more
  solutions make roughly equal sense, perhaps in different ways. You
  just have to go with something and, if it later turns out to be
  awkward, refactor it.
 
  One last note: there are many cases where it might be better to use
  composition in AS2 but inheritance in AS3. Adobe's display classes in
  AS3 are much better set up for extension, with a far more intelligent
  class hierarchy.
  --
  Mike Keesey
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



-- 
Juan Delgado - Zárate
http://zarate.tv
http://dandolachapa.com
http://loqueyosede.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-14 Thread T. Michael Keesey
On 8/14/07, Hans Wichman [EMAIL PROTECTED] wrote:
 Just on a side note, its not just -ow-what-shall-we-use-today- its a more
 fundamental conceptual issue as well, such as are you dealing with a is-a
 relationship or has-a or is-part-of-a etc.

 I don't know if better class hierarchies change that, but maybe they
 could...

Try working in Flex for a while and get back to me

One of the big problems with extending MovieClip in AS2 is that things
like _x, _y, etc. are basically just public variables. Thus
composition is often a good strategy simply because there's no way to
override these properties otherwise. But with the AS3 classes, you can
override anything: x, y, width, height, rotation, etc. (That's exactly
how the MX components work.)

Another advantage is that there are more classes to extend. In AS2, it
has to be a MovieClip, even if you just want to draw a box. But AS3
has Shape, Sprite, MovieClip, etc. You can extend the class that has
the functionality you need and no more. (Well, not much more)

Of course there are still cases where composition (as in a non-display
object wrapping a display object) is better, but I find them to be
much fewer in AS3.

-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry  Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread Michael Trim
Not all classes have to extend MovieClip (in fact, most shouldn't, and 
some would argue none should).

Just as an aside, I'd be interested to hear why some would argue that
you should never extend MovieClip? (Surely you have to for the Document
class) or is this a higher level theoretical argument?
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread Ron Wheeler
I do not believe that we have had to extend MovieClip in any application 
so far.
We tend to treat Movie Clips as a stage where you put things that you 
want rendered rather that a functional object.


I am not sure that I know the high level theoretical argument but one 
does see a lot of really strange code and problems come through the 
forum from people who have tried to bend a MovieClip into something that 
it really was never intended to be.


When you are trying to decide what Object to subclass, look at the basic 
tenets of OOP and decide if your new class is really an extension of a 
MovieClip or just a View object that needs a MovieClip to draw on.


If you just want to draw something on a MovieClip then create an Object 
that has a function/method that gets a MovieClip object as a parameter 
and draws on it. This makes your Object much easier to write and 
understand and  is likely a lot more reusable.


Ron


Michael Trim wrote:
Not all classes have to extend MovieClip (in fact, most shouldn't, and 


some would argue none should).

Just as an aside, I'd be interested to hear why some would argue that
you should never extend MovieClip? (Surely you have to for the Document
class) or is this a higher level theoretical argument?
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread Johannes Nel
i have not tested it, but in an as3 (or even a flex) project when you use
the fl.motion jobbies you need to extend movieclip (i read it somewhere, but
thinking about it i have used them in uicomponents so... this is prob wrong)
instead of sprite. thinking about it i am wrong most prob about that, but i
def read it on the adobe livedocs in regards to the fl.motion package
jobbies.

On 8/13/07, Ron Wheeler [EMAIL PROTECTED] wrote:

 I do not believe that we have had to extend MovieClip in any application
 so far.
 We tend to treat Movie Clips as a stage where you put things that you
 want rendered rather that a functional object.

 I am not sure that I know the high level theoretical argument but one
 does see a lot of really strange code and problems come through the
 forum from people who have tried to bend a MovieClip into something that
 it really was never intended to be.

 When you are trying to decide what Object to subclass, look at the basic
 tenets of OOP and decide if your new class is really an extension of a
 MovieClip or just a View object that needs a MovieClip to draw on.

 If you just want to draw something on a MovieClip then create an Object
 that has a function/method that gets a MovieClip object as a parameter
 and draws on it. This makes your Object much easier to write and
 understand and  is likely a lot more reusable.

 Ron


 Michael Trim wrote:
  Not all classes have to extend MovieClip (in fact, most shouldn't, and
 
  some would argue none should).
 
  Just as an aside, I'd be interested to hear why some would argue that
  you should never extend MovieClip? (Surely you have to for the Document
  class) or is this a higher level theoretical argument?
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 
 
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com




-- 
j:pn
http://www.memorphic.com/news/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread T. Michael Keesey
On 8/13/07, Andy Herrman [EMAIL PROTECTED] wrote:

 Specifically, if I'm wrapping MovieClip I'm generally creating
 something with a lot of special behavior, which sometimes causes
 restrictions on things like position and size.  If I extend MovieClip
 then all the built in MovieClip functions and properties are
 user-visible, so there's really nothing stopping someone from just
 doing myClass._width, etc.

This is definitely a valid argument in AS2. In AS3, however, the
problem goes away. You can override the getter and/or setter of any
property: x, y, width, height, etc. (In fact, this is exactly how Flex
components work.) And if you don't want something to ever be
overridden, you just use the final keyword.

-- 
Mike Keesey
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread T. Michael Keesey
On 8/13/07, Ron Wheeler [EMAIL PROTECTED] wrote:
 I do not believe that we have had to extend MovieClip in any application
 so far.
 We tend to treat Movie Clips as a stage where you put things that you
 want rendered rather that a functional object.

You don't *have* to, but that doesn't automatically mean it's bad
practice. Extending, rather than composing, MovieClip does have some
benefits. I find it makes it easier to work with designers/animators,
for one. Furthermore, look at the Flex framework--much of that uses
classes that extend DisplayObject (a simpler superclass of MovieClip
in AS3).

In the end a lot of it boils down to taste, I think. Personally I have
no problem with extending MovieClip or, in AS3, DisplayObject for
anything that appears visually.

-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry  Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread Andy Herrman
The reason I don't like extending MovieClip is that it gives the user
of my classes too much control over the internals of my class.

Specifically, if I'm wrapping MovieClip I'm generally creating
something with a lot of special behavior, which sometimes causes
restrictions on things like position and size.  If I extend MovieClip
then all the built in MovieClip functions and properties are
user-visible, so there's really nothing stopping someone from just
doing myClass._width, etc.

By using Composition I can restrict the public API to my class to
exactly those methods I want exposed.  All the extra internal state
that MovieClip makes visible is no longer visible to the user of my
class.

Now granted, if I'm the only one using my classes then you could argue
that there's really no difference, as I should just stick to using the
functions.  However, I like to code defensively and assume that, at
some point, others will be using/modifying my code.  Using Composition
makes it much easier to do that.

  -Andy

On 8/13/07, Michael Trim [EMAIL PROTECTED] wrote:
 Not all classes have to extend MovieClip (in fact, most shouldn't, and
 some would argue none should).

 Just as an aside, I'd be interested to hear why some would argue that
 you should never extend MovieClip? (Surely you have to for the Document
 class) or is this a higher level theoretical argument?
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread Steven Sacks

 You can override the getter and/or setter of any
 property: x, y, width, height, etc.

This is actually one of the benefits in AS2 of using composition instead 
of inheritance with MovieClip.


If you use composition, you can create your own proxy get/set MovieClip 
methods and do whatever you need before you pass it to the MovieClip itself.


The discussion about composition vs inheritance is well beyond a 101 
level course, it's more like 400 level.  ;)


Composition with MovieClips is something that you won't truly understand 
the benefits of until you do it a bunch.  Like many new design patterns 
that you learn, a light bulb will turn on and you'll have that Ah ha! 
moment and all will make sense.


One of the things to watch out for is when you learn a new design 
pattern you use it for everything, even when it isn't appropriate.  This 
is good for learning because it helps you find the limits of a design 
pattern's usefulness, but a lot of developers get stuck overusing 
particular design patterns when they're not really the right one to use.


Singleton has got to be the most over and misused design pattern in the 
history of design patterns.  Static classes, while not a design pattern, 
are a close second in the over and misused coding methodologies category.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-13 Thread T. Michael Keesey
On 8/13/07, Steven Sacks [EMAIL PROTECTED] wrote:
   You can override the getter and/or setter of any
   property: x, y, width, height, etc.

 This is actually one of the benefits in AS2 of using composition instead
 of inheritance with MovieClip.

But it should be noted that there are problems with using composition,
too. For example, you could pass control of one movie clip to more
than one View object. (Well, in some circumstances that could be seen
as a benefit, but I think it would usually be not so good.)

In the end, you just have to familiarize yourself with everything, try
different patterns, and see what makes the most sense on a
case-by-case basis. And oftentimes there are cases where two or more
solutions make roughly equal sense, perhaps in different ways. You
just have to go with something and, if it later turns out to be
awkward, refactor it.

One last note: there are many cases where it might be better to use
composition in AS2 but inheritance in AS3. Adobe's display classes in
AS3 are much better set up for extension, with a far more intelligent
class hierarchy.
-- 
Mike Keesey
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-11 Thread Hans Wichman
Hi,

I think you misinterpreted my mail about the two option with movieclip
inheritance vs composition.

I said (or at least I meant :)) that in HIS example he PROBABLY had a view
and THEN.

etc etc

:)


On 8/11/07, David Ngo [EMAIL PROTECTED] wrote:

 Precisely my point.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Steven
 Sacks
 Sent: Friday, August 10, 2007 7:13 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

 Not all classes have to extend MovieClip (in fact, most shouldn't, and
 some would argue none should).

 class tld.domain.project.utils.Algorithms
 {
 public static function someCalc(n:Number):Number
 {
// do some calculations on n
return n;
 }
 }



 David Ngo wrote:
  I'm not going to hijack this thread and get into a debate of inheritance
 vs.
  composition vs. whatever so I'll just pose this quick question to you.
 Keep
  in mind the context of the original question which led to the discussion
  here (having code on the timeline vs. using classes):
 
  If I need to create an algorithm to perform a series of calculations
 based
  off each other, where do I put that? Do I put it in a class that extends
  MovieClip or in a generic class? Or, going by your option, stick it on
 the
  timeline and use Math.
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-11 Thread Ron Wheeler

Some on-line resources
General OOP
http://java.sun.com/docs/books/tutorial/java/concepts/index.html - 
short, clear and free

http://www.aonaware.com/OOP1.htm - basic stuff again.
http://www.desy.de/gna/html/cc/Tutorial/tutorial.html - very long and 
detail - step by step  walk through the rational behind OOP - C++ from 1997


Actionscript and OOP
http://polygeek.com/360_adobeflash/actionscript_the-best-way-to-start-learning-object-oriented-programming-in-actionscript 
- a pre-course briefing to get you ready for OOP in ActionScript

http://www.moock.org/lectures/introToOOP/
http://www.kirupa.com/developer/oop2/AS2OOPindex.htm
http://www.flashscript.biz/MX2004/OOP_tutorial/lesson1.html
http://www.debreuil.com/docs/ch01_Intro.htm - Flash 5 but the OO part 
has not changed a lot.


I have added these links to
http://tech.groups.yahoo.com/group/Script_in_Action/

Also check out the books.
I highly recommend Head First Design Patterns if you want to see the 
power of objects clearly demonstrated.
It will save you hours of grappling with the design of your classes and 
cut your code in half while increasing robustness and reusability.


Ron

Marcelo Wolfgang wrote:

On 8/10/07, Hans Wichman [EMAIL PROTECTED] wrote:
  

Hehe no worries there, I'm sure we all do stuff that causes someone else to
say they need to kill... etc :)
It was meant as a joke nothing harsh to be honest:).



I got it :)

  

You are hijacking this thread though, which is in itself ofcourse enough
reason to ... :)



Sorry, I was about to ask about this for quite sometime, but I'm too
f. busy recently and when I saw the joke I had to answer :)


  

Some answer though:
- you dont code AS2 classes on frames, you just write as2 classes in files.
Once you compile your movie, flash lets you specify in which frame your
classes should be exported.



I think what I don't get the most is how do I transform this

function myFunction(){
  return this;
}

to a class and how I can call it later in something like

btClose_mc.onRelease = myFunction();

i'm thinking in buying moock's essential actionscript 3, but I'm
afraid it will hard to jump from where I'm now to where the book is.

TIA
Marcelo Wolfgang
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread David Ngo
Uh, and what if I just need to do some mathematical calculations that have
nothing to do with MovieClips or visual elements?

:)


Not all classes need to be associated with MovieClips (either by inheritance
or composition/aggregation). Classes are nothing more than Objects that can
have methods (aka functions) and/or properties (aka variables) and can even
inherit (extends) an existing Class/Object type or implement (err, I guess
implements) an interface. Inherently, all classes extend Object anyways but
that's probably out of the scope of this discussion.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman
Sent: Friday, August 10, 2007 4:16 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

Hi,

well ofcourse lots of ways lead to Rome.. trouble is even more ran past it,
into a chasm most likely, but you probably see two types of scenario's that
are most common:

1. your class extends a movieclip
2. your class wraps a movieclip

I dont want to get into a discussion on what the better solution, both cases
are similar.

In your example you have a button.
This button is probably on a screen/view/form whatever.

Commonly you will implement a class for this form. As said either it
subclasses the movieclip containing the button directly (which means you
will have a reference, you'll only need to declare it again in the class to
satisfy the compiler eg

class MyForm extends MovieClip {

}



On 8/10/07, Marcelo Wolfgang [EMAIL PROTECTED] wrote:

 On 8/10/07, Hans Wichman [EMAIL PROTECTED] wrote:
  Hehe no worries there, I'm sure we all do stuff that causes someone else
 to
  say they need to kill... etc :)
  It was meant as a joke nothing harsh to be honest:).

 I got it :)

  You are hijacking this thread though, which is in itself ofcourse enough
  reason to ... :)

 Sorry, I was about to ask about this for quite sometime, but I'm too
 f. busy recently and when I saw the joke I had to answer :)


  Some answer though:
  - you dont code AS2 classes on frames, you just write as2 classes in
 files.
  Once you compile your movie, flash lets you specify in which frame your
  classes should be exported.

 I think what I don't get the most is how do I transform this

 function myFunction(){
 return this;
 }

 to a class and how I can call it later in something like

 btClose_mc.onRelease = myFunction();

 i'm thinking in buying moock's essential actionscript 3, but I'm
 afraid it will hard to jump from where I'm now to where the book is.

 TIA
 Marcelo Wolfgang
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread Hans Wichman
use Math. :))) your turn :)

On 8/10/07, David Ngo [EMAIL PROTECTED] wrote:

 Uh, and what if I just need to do some mathematical calculations that have
 nothing to do with MovieClips or visual elements?

 :)


 Not all classes need to be associated with MovieClips (either by
 inheritance
 or composition/aggregation). Classes are nothing more than Objects that
 can
 have methods (aka functions) and/or properties (aka variables) and can
 even
 inherit (extends) an existing Class/Object type or implement (err, I guess
 implements) an interface. Inherently, all classes extend Object anyways
 but
 that's probably out of the scope of this discussion.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Hans
 Wichman
 Sent: Friday, August 10, 2007 4:16 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

 Hi,

 well ofcourse lots of ways lead to Rome.. trouble is even more ran past
 it,
 into a chasm most likely, but you probably see two types of scenario's
 that
 are most common:

 1. your class extends a movieclip
 2. your class wraps a movieclip

 I dont want to get into a discussion on what the better solution, both
 cases
 are similar.

 In your example you have a button.
 This button is probably on a screen/view/form whatever.

 Commonly you will implement a class for this form. As said either it
 subclasses the movieclip containing the button directly (which means you
 will have a reference, you'll only need to declare it again in the class
 to
 satisfy the compiler eg

 class MyForm extends MovieClip {

 }



 On 8/10/07, Marcelo Wolfgang [EMAIL PROTECTED] wrote:
 
  On 8/10/07, Hans Wichman [EMAIL PROTECTED] wrote:
   Hehe no worries there, I'm sure we all do stuff that causes someone
 else
  to
   say they need to kill... etc :)
   It was meant as a joke nothing harsh to be honest:).
 
  I got it :)
 
   You are hijacking this thread though, which is in itself ofcourse
 enough
   reason to ... :)
 
  Sorry, I was about to ask about this for quite sometime, but I'm too
  f. busy recently and when I saw the joke I had to answer :)
 
 
   Some answer though:
   - you dont code AS2 classes on frames, you just write as2 classes in
  files.
   Once you compile your movie, flash lets you specify in which frame
 your
   classes should be exported.
 
  I think what I don't get the most is how do I transform this
 
  function myFunction(){
  return this;
  }
 
  to a class and how I can call it later in something like
 
  btClose_mc.onRelease = myFunction();
 
  i'm thinking in buying moock's essential actionscript 3, but I'm
  afraid it will hard to jump from where I'm now to where the book is.
 
  TIA
  Marcelo Wolfgang
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread Marcelo Wolfgang

ok let me see if I get this right then:

class MyForm extends MovieClip{

// ok so now I can call a movieclip.MyForm and it will execute the code 
that is inside this ( add a function to the button onPress ), the button 
should be created here or it can be an symbol in the lybrary that I will 
put on the stage with a normal attachMovie ? this is the part that I 
don't get...


private var btClose_mc:Button;
// just declared a variable that is only accessed inside this class, so 
If I use btClose_mc anywhere else it will be undefined right ?


private function onLoad(){
   bt.Close_mc.onPress = Delegate.create(this, this.myFunction);
}
// same thing as before, this function is only visible inside of the 
class, and it only be avaible when the button is created, it will assign 
myFunction to it's onPress event handler.


private function myFunction(){
   doSomething
}
// the function that will be called when you have the onPress event fired.


Marcelo

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread David Ngo
I'm not going to hijack this thread and get into a debate of inheritance vs.
composition vs. whatever so I'll just pose this quick question to you. Keep
in mind the context of the original question which led to the discussion
here (having code on the timeline vs. using classes):

If I need to create an algorithm to perform a series of calculations based
off each other, where do I put that? Do I put it in a class that extends
MovieClip or in a generic class? Or, going by your option, stick it on the
timeline and use Math.


:)



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman
Sent: Friday, August 10, 2007 4:45 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

use Math. :))) your turn :)

On 8/10/07, David Ngo [EMAIL PROTECTED] wrote:

 Uh, and what if I just need to do some mathematical calculations that have
 nothing to do with MovieClips or visual elements?

 :)


 Not all classes need to be associated with MovieClips (either by
 inheritance
 or composition/aggregation). Classes are nothing more than Objects that
 can
 have methods (aka functions) and/or properties (aka variables) and can
 even
 inherit (extends) an existing Class/Object type or implement (err, I guess
 implements) an interface. Inherently, all classes extend Object anyways
 but
 that's probably out of the scope of this discussion.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Hans
 Wichman
 Sent: Friday, August 10, 2007 4:16 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

 Hi,

 well ofcourse lots of ways lead to Rome.. trouble is even more ran past
 it,
 into a chasm most likely, but you probably see two types of scenario's
 that
 are most common:

 1. your class extends a movieclip
 2. your class wraps a movieclip

 I dont want to get into a discussion on what the better solution, both
 cases
 are similar.

 In your example you have a button.
 This button is probably on a screen/view/form whatever.

 Commonly you will implement a class for this form. As said either it
 subclasses the movieclip containing the button directly (which means you
 will have a reference, you'll only need to declare it again in the class
 to
 satisfy the compiler eg

 class MyForm extends MovieClip {

 }



 On 8/10/07, Marcelo Wolfgang [EMAIL PROTECTED] wrote:
 
  On 8/10/07, Hans Wichman [EMAIL PROTECTED] wrote:
   Hehe no worries there, I'm sure we all do stuff that causes someone
 else
  to
   say they need to kill... etc :)
   It was meant as a joke nothing harsh to be honest:).
 
  I got it :)
 
   You are hijacking this thread though, which is in itself ofcourse
 enough
   reason to ... :)
 
  Sorry, I was about to ask about this for quite sometime, but I'm too
  f. busy recently and when I saw the joke I had to answer :)
 
 
   Some answer though:
   - you dont code AS2 classes on frames, you just write as2 classes in
  files.
   Once you compile your movie, flash lets you specify in which frame
 your
   classes should be exported.
 
  I think what I don't get the most is how do I transform this
 
  function myFunction(){
  return this;
  }
 
  to a class and how I can call it later in something like
 
  btClose_mc.onRelease = myFunction();
 
  i'm thinking in buying moock's essential actionscript 3, but I'm
  afraid it will hard to jump from where I'm now to where the book is.
 
  TIA
  Marcelo Wolfgang
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread T. Michael Keesey
On 8/10/07, David Ngo [EMAIL PROTECTED] wrote:

 If I need to create an algorithm to perform a series of calculations based
 off each other, where do I put that? Do I put it in a class that extends
 MovieClip or in a generic class?

That really depends. If only one type of movieclip is ever going to
use this algorithm (EVER), then go ahead and put it in that class. On
the other hand, if different movieclips need to use it, I'd make it a
composed generic class (i.e., extended from Object or EventDispatcher
or whatever) or, if at all possible, a static class.

Need details.
-- 
Mike Keesey
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread Steven Sacks
Not all classes have to extend MovieClip (in fact, most shouldn't, and 
some would argue none should).


class tld.domain.project.utils.Algorithms
{
public static function someCalc(n:Number):Number
{
// do some calculations on n
return n;
}
}



David Ngo wrote:

I'm not going to hijack this thread and get into a debate of inheritance vs.
composition vs. whatever so I'll just pose this quick question to you. Keep
in mind the context of the original question which led to the discussion
here (having code on the timeline vs. using classes):

If I need to create an algorithm to perform a series of calculations based
off each other, where do I put that? Do I put it in a class that extends
MovieClip or in a generic class? Or, going by your option, stick it on the
timeline and use Math.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Classes 101 [was: Version control and Flash ]

2007-08-10 Thread David Ngo
Precisely my point.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Friday, August 10, 2007 7:13 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Classes 101 [was: Version control and Flash ]

Not all classes have to extend MovieClip (in fact, most shouldn't, and 
some would argue none should).

class tld.domain.project.utils.Algorithms
{
 public static function someCalc(n:Number):Number
 {
// do some calculations on n
return n;
 }
}



David Ngo wrote:
 I'm not going to hijack this thread and get into a debate of inheritance
vs.
 composition vs. whatever so I'll just pose this quick question to you.
Keep
 in mind the context of the original question which led to the discussion
 here (having code on the timeline vs. using classes):
 
 If I need to create an algorithm to perform a series of calculations based
 off each other, where do I put that? Do I put it in a class that extends
 MovieClip or in a generic class? Or, going by your option, stick it on the
 timeline and use Math.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com