Hello :)

In AS3 the apply method don't exist over the constructor.. the constructor
in AS3 isn't a Function but a Class object and the Class object don't
implément the apply or call methods !

It's a big problem for me....

For the moment the solutions are :

1 - In your case... use composition over your Array, like :

http://svn1.cvsdude.com/osflash/vegas/AS3/trunk/src/vegas/data/iterator/ArrayIterator.as(for
me the best solution !)

2 - use a constructor with an Array or Object in arguments

3 - in your class you can use the ...args:Array and use it with a for or
while loop :)

PS : When i wan't create a full object with a custom class reference and a
dynamic array of arguments i use my method buildNewInstance :

http://svn1.cvsdude.com/osflash/vegas/AS3/trunk/src/vegas/util/ClassUtil.as

EKA+ :)


2008/6/26 Morten Barklund <[EMAIL PROTECTED]>:

> Hi Sidney,
>
> You have of course tried the obvious:
>
>  super.apply(this, args)
>
> How did it fail, compiler error or?
>
> Regards,
> Morten Barklund
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] On Behalf Of Sidney de Koning
> Sent: Thursday, June 26, 2008 4:30 PM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Calling super.apply
>
> He Jer,
>
> In the docs it says: public dynamic class Array
> So you can extend it. My problem is that now i have to use push() to
> get items in and i want to use the constructor to pass through items,
> like so var blah:ArrayInterator = new ArrayIterator("1", "2","3");
>
> My constructor uses ..rest so with apply i pass though all the
> arguments one, by one instead of as one big array because ...rest is
> an array itself
>
> Does this all makes sense?
>
> The problem is that i cant seem to figure out how to call apply on the
> super.
>
> Does any body know? let me know!!!
>
> Cheers, Sid
>
>
> On Jun 26, 2008, at 3:31 PM, Jer Brand wrote:
>
> > I'm probably wrong (and mostly want to know as well), but I didn't
> > think you could extend the Array class. Not that AS won't let you do
> > it, but it doesn't actually work. I know this is the case with AS2,
> > but am only guessing that it's the case with AS3 from the behavior you
> > describe.
> >
> > My suggestion would be to use composition rather than inheritance.
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to