Re: [Flashcoders] Casting to Array
btw one more compilaltion error circumventing hack that seems to work: [yourObj][0] ;-S greetz JC On 7/24/07, Danny Kodicek <[EMAIL PROTECTED]> wrote: > > > > > That's a fair point. It's more the principle of the thing - it was > > > frustrating not to be *able* to make it strict. But yes, leaving off > > > the :Object would be a better solution. > > > > Well, you can't do argument overloading in AS2 (nor AS3, I believe), so > > you can't have pure polymorphism in Flash the way you can in other > > languages like Java. Such is life. > > > > Alternatively, you could write your own class for the argument that > could > > be an array or an object and then cast it strictly as that class. > > Well, it would work just as well to have > > Class StrictArray extends Array { > } > > Ought to work perfectly (although I'd be interested to see whether bracket > access still works). But yes, why bother? :) > > Danny > > ___ > 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
Re: [Flashcoders] Casting to Array
> That's a fair point. It's more the principle of the thing - it was > frustrating not to be *able* to make it strict. But yes, leaving off > the :Object would be a better solution. Well, you can't do argument overloading in AS2 (nor AS3, I believe), so you can't have pure polymorphism in Flash the way you can in other languages like Java. Such is life. Alternatively, you could write your own class for the argument that could be an array or an object and then cast it strictly as that class. Well, it would work just as well to have Class StrictArray extends Array { } Ought to work perfectly (although I'd be interested to see whether bracket access still works). But yes, why bother? :) Danny ___ 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
Re: [Flashcoders] Casting to Array
> That's a fair point. It's more the principle of the thing - it was > frustrating not to be *able* to make it strict. But yes, leaving off > the :Object would be a better solution. Well, you can't do argument overloading in AS2 (nor AS3, I believe), so you can't have pure polymorphism in Flash the way you can in other languages like Java. Such is life. Alternatively, you could write your own class for the argument that could be an array or an object and then cast it strictly as that class. Seems a lot of work for what amounts to almost no gain. ;) ___ 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
Re: [Flashcoders] Casting to Array
You're "hacking" it either way. This one function is not going to cause coder confusion. You're leaving the type off so you can pass any type. Considering you type everything else, it's pretty obvious to anyone who looks at it what's going on. Adding extra lines of code that put a parameter into an object is possibly MORE confusing than leaving off a type which the next line shows exactly why (if param instanceof). AS3 has *, AS2 has blank. I think it's hacky to add more lines of code versus what I don't think is hacky which is leaving off a type in AS2. That's HOW you accept any type of param in AS2. That's a fair point. It's more the principle of the thing - it was frustrating not to be *able* to make it strict. But yes, leaving off the :Object would be a better solution. Danny ___ 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
Re: [Flashcoders] Casting to Array
In the more general case, I disagree that AS2 gains nothing from type-checking. But you weren't being general. :-) I thought I was, but I realize now that I made a flawed assumption. You don't know my coding practices and how I write everything as strict as I can and use MTASC for compiling, etc. If you did, you would have known I was being general, heh. ;) ___ 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
Re: [Flashcoders] Casting to Array
You're "hacking" it either way. This one function is not going to cause coder confusion. You're leaving the type off so you can pass any type. Considering you type everything else, it's pretty obvious to anyone who looks at it what's going on. Adding extra lines of code that put a parameter into an object is possibly MORE confusing than leaving off a type which the next line shows exactly why (if param instanceof). AS3 has *, AS2 has blank. I think it's hacky to add more lines of code versus what I don't think is hacky which is leaving off a type in AS2. That's HOW you accept any type of param in AS2. Keep It Simple Stupid: http://en.wikipedia.org/wiki/KISS_principle :) ___ 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
Re: [Flashcoders] Casting to Array
Steven, I do see what you're getting at - having reviewed Danny's code, in this instance, you're right (and I was being too general and should have paid more attention!). In the more general case, I disagree that AS2 gains nothing from type-checking. But you weren't being general. :-) Ian On 7/23/07, Steven Sacks <[EMAIL PROTECTED]> wrote: You're "hacking" it either way. This one function is not going to cause coder confusion. You're leaving the type off so you can pass any type. Considering you type everything else, it's pretty obvious to anyone who looks at it what's going on. Adding extra lines of code that put a parameter into an object is possibly MORE confusing than leaving off a type which the next line shows exactly why (if param instanceof). AS3 has *, AS2 has blank. I think it's hacky to add more lines of code versus what I don't think is hacky which is leaving off a type in AS2. That's HOW you accept any type of param in AS2. Keep It Simple Stupid: http://en.wikipedia.org/wiki/KISS_principle :) ___ 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
Re: [Flashcoders] Casting to Array
On 7/23/07, Steven Sacks <[EMAIL PROTECTED]> wrote: If you look at it objectively, you're adding extra lines of code for no reason. AS2 has absolutely no gains from strict typing. The compiled code doesn't gain anything - but if (like me) you're writing code libraries to be used by other programmers, the gain is type-checking at compile-time. Which is no small thing. I grant you the hack I use throws away type safety (unless you surround it with a run-time check for instanceof Array), but if the hack is useful in that it lets you present a type-checked API to other coders, then it most definitely is worth it. Never underestimate the ability of someone to pass in the wrong parameters to a function. (Even yourself). And then to spend hours scratching their (your) head to work out what's wrong. If you were using AS3, you could use :* but you're not so the equivalent in AS2 is to leave off the type. As I said earlier, in AS3 you can use the 'as' cast operator instead of Array(a): var b:Array=a as Array; Ian ___ 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
Re: [Flashcoders] Casting to Array
> The solution I used works much the same way as Ian's: essentially it takes > advantage of the fact that Flash's compiler isn't able to check the object > type of sub-items of an object or array, so it ignores them (and assumes > you've done your job correctly). Danny, It seems to me if you're willing to use a "hack" like this, you might as well take the :Object off your tObj parameter and call it a day. :) If you look at it objectively, you're adding extra lines of code for no reason. AS2 has absolutely no gains from strict typing. The compiled code looks exactly the same whether you use typing or not. Also, you're tricking the compiler here anyway, so any benefit from typing the parameter is lost. Why not do it by deleting 7 characters instead of adding a couple of lines of code? If you were using AS3, you could use :* but you're not so the equivalent in AS2 is to leave off the type. My 2 cents. ___ 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
Re: [Flashcoders] Casting to Array
Danny, You can use an Array method like slice() or concat([]), which will create a duplicate of ur original array, and pass that to your function. So your code would become: function generic(tObj:Object) { if (tObj instanceof Array) { doMyArrayFunction(tObj.slice()) } else { doSomethingElse() } } function doMyArrayFunction(tArr:Array) { ... } Unless there is some compelling reason that you have to pass around the same array's reference, this should help. Cheers, Arul Prasad. On 7/23/07, Danny Kodicek <[EMAIL PROTECTED]> wrote: > Danny, > > I'm still not entirely clear on what you're attempting to do. > Can you show more code to give us a bigger picture? Thanks to everyone for suggestions and comments. Many of them, I suspect, would suffer from the same problem, though. For Steven, here's the problem in a bit more detail: function generic(tObj:Object) { if (tObj instanceof Array) { doMyArrayFunction(tObj) } else { doSomethingElse() } } function doMyArrayFunction(tArr:Array) { ... } This throws a compiler error because in the first function tObj is defined as an Object and the compiler isn't clever enough to realise that by the time we reach doMyArrayFunction it has to be of type Array. If the class I was trying to cast it to was anything except Array, I could use something like this: function generic(tObj:Object) { if (tObj instanceof MyClass) { doMyFunction(MyClass(tObj)) } else { doSomethingElse() } But because Array has a special constructor, Array(tObj) returns [tObj] instead of leaving it unchanged and just casting it to an Array. The solution I used works much the same way as Ian's: essentially it takes advantage of the fact that Flash's compiler isn't able to check the object type of sub-items of an object or array, so it ignores them (and assumes you've done your job correctly). John's solution is probably better from a strict OO standpoint, but mine works well enough, so... Danny ___ 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 -- Arul Prasad http://arulprasad.blogspot.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
RE: [Flashcoders] Casting to Array
> Danny, > > I'm still not entirely clear on what you're attempting to do. > Can you show more code to give us a bigger picture? Thanks to everyone for suggestions and comments. Many of them, I suspect, would suffer from the same problem, though. For Steven, here's the problem in a bit more detail: function generic(tObj:Object) { if (tObj instanceof Array) { doMyArrayFunction(tObj) } else { doSomethingElse() } } function doMyArrayFunction(tArr:Array) { ... } This throws a compiler error because in the first function tObj is defined as an Object and the compiler isn't clever enough to realise that by the time we reach doMyArrayFunction it has to be of type Array. If the class I was trying to cast it to was anything except Array, I could use something like this: function generic(tObj:Object) { if (tObj instanceof MyClass) { doMyFunction(MyClass(tObj)) } else { doSomethingElse() } But because Array has a special constructor, Array(tObj) returns [tObj] instead of leaving it unchanged and just casting it to an Array. The solution I used works much the same way as Ian's: essentially it takes advantage of the fact that Flash's compiler isn't able to check the object type of sub-items of an object or array, so it ignores them (and assumes you've done your job correctly). John's solution is probably better from a strict OO standpoint, but mine works well enough, so... Danny ___ 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
RE: RE: [Flashcoders] Casting to Array
That is correct. If you need the reference to the actual array, then I would consider using a class to help cast your data as suggested by others. But if you just need the data and not the actual reference (meaning you don't need to persist that data anywhere else), then my solution should be fine. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mark Hawley Sent: Friday, July 20, 2007 1:44 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: RE: [Flashcoders] Casting to Array 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: > 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 > > ___ > 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 > -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ 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
Re: [Flashcoders] Casting to Array
Hi Danny, its an annoying issue and a subtle difference between the flash ide and mtasc as well. When compiling in mtasc, Array(myObject) becomes a regular cast and not the freakish thing its in the Flash IDE:). greetz JC On 7/20/07, Steven Sacks <[EMAIL PROTECTED]> wrote: Danny, I'm still not entirely clear on what you're attempting to do. Can you show more code to give us a bigger picture? Danny Kodicek wrote: > I'm trying to do something like this: > > if (a instanceof Array) { > doMyArrayFunction(a) > } > ___ 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
Re: [Flashcoders] Casting to Array
Well, you can write your own casting function, something like this function toArray(a): Array { return a; } Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Danny Kodicek <[EMAIL PROTECTED]> To: flashcoders@chattyfig.figleaf.com Date:Friday, July 20, 2007, 3:03:55 PM Subject: [Flashcoders] Casting to Array --===-- I'm trying to do something like this: if (a instanceof Array) { doMyArrayFunction(a) } the doMyArrayFunction expects an Array object, so this throws an error. What I would normally do in this case is cast the object to the class I'm expecting, but unfortunately Array(a) doesn't leave a unchanged, as it would with most classes, but returns [a] - the array gets nested. Anyone have a suggestion as to how I can get around this? The only thing I can think of is Array(a)[0], which seems a bit stupid. (I'm in AS2) Danny ___ 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
Re: [Flashcoders] Casting to Array
Danny, I'm still not entirely clear on what you're attempting to do. Can you show more code to give us a bigger picture? Danny Kodicek wrote: I'm trying to do something like this: if (a instanceof Array) { doMyArrayFunction(a) } ___ 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
Re: RE: [Flashcoders] Casting to Array
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: > 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 > > ___ > 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 > -- John Mark Hawley The Nilbog Group 773.968.4980 (cell) ___ 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
Re: [Flashcoders] Casting to Array
- Original Message - From: "Danny Kodicek" <[EMAIL PROTECTED]> To: Sent: Friday, July 20, 2007 2:03 PM Subject: [Flashcoders] Casting to Array I'm trying to do something like this: if (a instanceof Array) { doMyArrayFunction(a) } the doMyArrayFunction expects an Array object, so this throws an error. What I would normally do in this case is cast the object to the class I'm expecting, but unfortunately Array(a) doesn't leave a unchanged, as it would with most classes, but returns [a] - the array gets nested. Anyone have a suggestion as to how I can get around this? The only thing I can think of is Array(a)[0], which seems a bit stupid. (I'm in AS2) Danny How about: if (a instanceof Array) { var t:Array = a; doMyArrayFunction(t) } Paul ___ 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
Re: [Flashcoders] Casting to Array
Danny, The shortest way I found of doing it is: var b:Array={arr:a}.arr; i.e. make it a property of an object, then unbox it again. Silly, but works syntactically. I'd love to see a shorter way. In AS3, Array(x) as an array creator still exists - you get around it using the new 'as' operator: var b:Array=a as Array; Ian On 7/20/07, Danny Kodicek <[EMAIL PROTECTED]> wrote: I'm trying to do something like this: if (a instanceof Array) { doMyArrayFunction(a) } the doMyArrayFunction expects an Array object, so this throws an error. What I would normally do in this case is cast the object to the class I'm expecting, but unfortunately Array(a) doesn't leave a unchanged, as it would with most classes, but returns [a] - the array gets nested. Anyone have a suggestion as to how I can get around this? The only thing I can think of is Array(a)[0], which seems a bit stupid. (I'm in AS2) Danny ___ 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
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 ___ 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
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. Jim Kremens ___ 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
RE: [Flashcoders] Casting to Array
Try this: if (a instanceof Array) { var n:Array = a.slice(); doMyArrayFunction(n); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Kodicek Sent: Friday, July 20, 2007 9:04 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Casting to Array I'm trying to do something like this: if (a instanceof Array) { doMyArrayFunction(a) } the doMyArrayFunction expects an Array object, so this throws an error. What I would normally do in this case is cast the object to the class I'm expecting, but unfortunately Array(a) doesn't leave a unchanged, as it would with most classes, but returns [a] - the array gets nested. Anyone have a suggestion as to how I can get around this? The only thing I can think of is Array(a)[0], which seems a bit stupid. (I'm in AS2) Danny ___ 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