Check this out..

Mixins, How to.
http://flexonrails.net/?p=79


--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> Of course, I always forger about the "dynamic" keyword :)
> 
> On Tue, Apr 29, 2008 at 1:18 PM, Bjorn Schultheiss <
> [EMAIL PROTECTED]> wrote:
> 
> >   I believe you can do this
> >
> > class Foo
> > {
> > var bar:Function;
> > }
> >
> > //somewhere outside the class
> >
> > function myfunction():void {trace('hi')};
> >
> >
> > var foo:Foo = new Foo;
> > foo.bar = myfunction;
> >
> > if you have
> > class Foo
> > {
> > function bar():void {}
> > }
> >
> > then you must override.
> >
> > But you have more flexibility if Foo is defined as a Dynamic Class..
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
"Josh
> > McDonald" <dznuts@> wrote:
> > >
> > > Thanks for that info.
> > >
> > > I'm not really sure about how things work internally, besides
some vague
> > > references to "traits" the documentation doesn't help too much -
can you
> > > redefine member methods on a particular instance?
> > >
> > > What I mean is this:
> > >
> > > var foo : Foo = new Foo();
> > > foo.bar(); // Does something
> > > foo.bar = function() : void { doOtherStuff() };
> > > foo.bar(); // Does something else
> > >
> > > -J
> > >
> > > On Tue, Apr 29, 2008 at 10:14 AM, Gordon Smith <gosmith@> wrote:
> > >
> > > > I think there is additional overhead in calling an anonymous
> > function
> > > > (i.e., your 'var foo:Function = ' case).
> > > >
> > > >
> > > >
> > > > And I don't think that the rules for what 'this' is, when the
function
> > > > executes, are the same.
> > > >
> > > >
> > > >
> > > > Gordon Smith
> > > >
> > > > Adobe Flex SDK Team
> > > >
> > > >
> > > > ------------------------------
> > > >
> > > > *From:* flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > [mailto:flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] *On
> > > > Behalf Of *Josh McDonald
> > > > *Sent:* Monday, April 28, 2008 4:58 PM
> > > > *To:* flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > > *Subject:* Re: [flexcoders] Advanced(?) Actionscript question
> > > >
> > > >
> > > >
> > > > Of course you're right, my syntax was dodgey. I meant:
> > > >
> > > > var foo : Function = function():* {};
> > > >
> > > > But besides that, my questions still stand ;-)
> > > >
> > > > -J
> > > >
> > > > On Tue, Apr 29, 2008 at 9:45 AM, Bjorn Schultheiss <
> > > > bjorn.mailinglists@> wrote:
> > > >
> > > > In the second version your initializing foo as an object.
> > > >
> > > >
> > > >
> > > > I'm pretty certain you cant do,
> > > >
> > > > var foo:Function = {trace('foo')}
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On 29/04/2008, at 9:37 AM, Josh McDonald wrote:
> > > >
> > > > Guys,
> > > >
> > > > what's the difference (if it exists) between:
> > > >
> > > > public function foo() : * {}
> > > >
> > > > and:
> > > >
> > > > public var foo : Function = {};
> > > >
> > > > Does it exist? I assume you can call Bar.foo() in both cases,
and foo
> > > > shows up as a variable in describeType() in the second instance?
> > Are there
> > > > other details I'm not aware of?
> > > >
> > > > Cheers,
> > > >
> > > > -J
> > > >
> > > > --
> > > > "Therefore, send not to know For whom the bell tolls. It tolls for
> > thee."
> > > >
> > > > :: Josh 'G-Funk' McDonald
> > > > :: 0437 221 380 :: josh@
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > "Therefore, send not to know For whom the bell tolls. It tolls for
> > thee."
> > > >
> > > > :: Josh 'G-Funk' McDonald
> > > > :: 0437 221 380 :: josh@
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > "Therefore, send not to know For whom the bell tolls. It tolls for
> > thee."
> > >
> > > :: Josh 'G-Funk' McDonald
> > > :: 0437 221 380 :: josh@
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for
thee."
> 
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>


Reply via email to