Well, you can write your own casting function, something like this
function toArray(a): Array {
return a;
}
Attila
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Danny Kodicek <[EMAIL PROTECTED]>
To: [email protected] <[email protected]>
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
_______________________________________________
[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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
_______________________________________________
[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