David's suggestion doesn't actually cast to array, though -- it makes a shallow copy of the array and returns it. This will lead you to many tricky bugs.
If you really *really* need type checking on arrays, make a List class to wrap arrays and only use that. > > From: "Danny Kodicek" <[EMAIL PROTECTED]> > Date: 2007/07/20 Fri AM 10:07:47 CDT > To: <[email protected]> > Subject: RE: [Flashcoders] Casting to Array > > > As it's AS2, you might think about making it so > > doMyArrayFunction will not expect an array, but will take anything: > > > > class ArrayTest { > > > > public function ArrayTest(a) { > > trace(a[0]); > > } > > > > } > > > > > > > > new ArrayTest([1,2,3,4]); > > > > works fine. > > Yes, but I'm trying to do things 'properly' :) > > I've been quite enjoying the discipline of strong typing and it seems a > shame to lose it for a little technicality. I like David's suggestion, which > I'd imagine works pretty fast. > > Thanks > Danny > > _______________________________________________ > [email protected] > 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 > -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) _______________________________________________ [email protected] 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

