Wow talking about pressing the wrong buttons :)

let me continue that mail below :))

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

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

private var btClose_mc:Button;

private function onLoad() {
    btClose_mc.onPress = Delegate.create (this, this.myFunction);
}
private function myFunction(){
//do something}
}

In the scenario above, the class will be linked to the clip in the library
and instantiated automatically when you create an instance of the clip.

OR you create a wrapping class, meaning you first have to instantiate the
clip yourself and then go something like:
var myForm:MyForm = new MyForm (_root.myForm_mc);

The example becomes slightly different then, using a constructor;

public function MyForm (formRef:MovieClip) {
   btClose_mc = formRef.btClose_mc;
   btClose_mc.onPress = ... etc
}

Don't mind the lack of code conventions at this point, I dont have that much
time :)

HTH
JC


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

Reply via email to