Using the as Operator to Cast to Date and Array
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var numbers:Array = [1,2,3]
output(numbers);
}
public function output (msg:Object):void {
if (msg is String) {
trace(msg);
}
if (msg is Array) {
var arr:Array = msg as Array; // "Cast" to Array here
trace(arr.join("\n"));
}
}
}
}
Related examples in the same category