> If I extend a class and in the subclass override a function of the
base class
> I can call the original base class function using super.functionname.
> How do I pass all the arguments present in the arguments array to the
> super function?

 

If a superclass has the method with a variable number of arguments like

 

    public function f(...args):void

    {

        ...

    }

 

then in a subclass the override would call the supermethod like this:

 

    override public function f(...args):void

    {

        super.f(args);

        ...

    }

 

> there is no mention of the prototype property I could find

 

I'm curious what you're doing with the 'prototype' property. It's pretty
much vestigial at this point because AS3 uses class-based, rather than
prototype-based, inheritance.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dev.bits
Sent: Tuesday, June 24, 2008 8:34 PM
To: [email protected]
Subject: [flexcoders] Re: Inheritance : Calling super.function with var
args

 

dude, you are awesome! it worked 

I was looking for invoke (thats what javascript has for doing this)
and couldn't find it. I had seen that page (not apply but that page)
and had ignored it considering the huge differences between AS3 and
AS2 (I wanted something for AS2, which I now realise I never mentioned
:). <rant> The adobe AS2 documentation is a real pain .. there is no
mention of the prototype property I could find </rant>

anyways, thanks a lot for the awesome help (and the quick replies! )

Regards
Devdatta

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> Sorry mate, that's my bad! you want .apply, not .call! My fault, I
should've
> double-checked before I posted!
> 
> http://livedocs.adobe.com/flex/3/langref/Function.html#apply
<http://livedocs.adobe.com/flex/3/langref/Function.html#apply> ()
> 
> -Josh
> 
> 
> 
> On Wed, Jun 25, 2008 at 12:57 PM, dev.bits <[EMAIL PROTECTED]> wrote:
> 
> > yeah I had tried that ! :)
> >
> > But it doesn't work ... I thought it was the problem "this" but
> > clearly this doesn't work :
> > flash.external.ExternalInterface.call.call(null,arguments);
> > doesn't work .
> > but
> > flash.external.ExternalInterface.call.call(null,"alert","whoa");
> >
> > works. So I guess we come back to the same problem... arguments
passes
> > the args as 1 argument (an array) whereas we want to pass the each
> > member of the arguments array as an argument each.
> >
> >
> > Regards
> > Devdatta
> >
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Josh McDonald" <dznuts@> wrote:
> > >
> > > Ah, you didn't say it was a static function :)
> > >
> > > Just put "null" instead of "this" and it should work.
> > >
> > > -Josh
> > >
> > > On Wed, Jun 25, 2008 at 12:36 PM, dev.bits <dev.akhawe@> wrote:
> > >
> > > >
> > > > Doesn't work for me .. says "this" not accessible ...
> > > >
> > > > See this code for e.g :
> > > > class package1.subpackage.newExternalInterface extends
> > > > flash.external.ExternalInterface{
> > > > public static function call(methodName:String):Object{
> > > > trace("called
newExternalInterface.called");
> > > >
> > > > return
> > > > flash.external.ExternalInterface.call.call(this,arguments);
> > > > //Compiler says this not accessible from this scope
> > > > }
> > > > }
> > > >
> > > > Regards
> > > > Devdatta
> > > >
> > > >
> > > >
> > > > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Josh McDonald" <dznuts@>
wrote:
> > > > >
> > > > > Try:
> > > > >
> > > > > super.functionName.call(this, argsArray);
> > > > >
> > > > > -Josh
> > > > >
> > > > > On Wed, Jun 25, 2008 at 11:14 AM, dev.bits <dev.akhawe@>
wrote:
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > If I extend a class and in the subclass override a
function of the
> > > > > > base class I can call the original base class function using
> > > > > > super.functionname
> > > > > >
> > > > > > But what do I do if this function excepts variable number of
> > > > arguments ?
> > > > > >
> > > > > > How do I pass all the arguments present in the arguments
array
> > to the
> > > > > > super function?
> > > > > >
> > > > > > public override function a(){
> > > > > > super.a( // here I want to pass ALL the arguments that
were passed
> > > > > > // to this function
> > > > > >
> > > > > >
> > > > > > Regards
> > > > > > Devdatta
> > > > > >
> > > > > >
> > > > > > ------------------------------------
> > > > > >
> > > > > > --
> > > > > > Flexcoders Mailing List
> > > > > > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
> > > > > > Search Archives:
> > > > > >
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> !
> > Groups
> > > > > > Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > "Therefore, send not to know For whom the bell tolls. It
tolls for
> > > > thee."
> > > > >
> > > > > :: Josh 'G-Funk' McDonald
> > > > > :: 0437 221 380 :: josh@
> > > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > --
> > > > Flexcoders Mailing List
> > > > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
> > > > Search Archives:
> > > > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> !
Groups
> > > > Links
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > "Therefore, send not to know For whom the bell tolls. It tolls for
> > thee."
> > >
> > > :: Josh 'G-Funk' McDonald
> > > :: 0437 221 380 :: josh@
> > >
> >
> >
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> ! Groups
> > Links
> >
> >
> >
> >
> 
> 
> -- 
> "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