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 _______________________________________________ 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