----- Original Message ----- From: "Danny Kodicek" <[EMAIL PROTECTED]>
To: <[email protected]>
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


_______________________________________________
[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

Reply via email to